import reducer from 'src/data_explorer/reducers/ui'

import {
  addQuery,
  deleteQuery,
  showWriteForm,
  hideWriteForm,
} from 'src/data_explorer/actions/view'

const noopAction = () => {
  return {type: 'NOOP'}
}

let state

describe('DataExplorer.Reducers.UI', () => {
  it('it sets the default state for UI', () => {
    const actual = reducer(state, noopAction())
    const expected = {
      queryIDs: [],
    }

    expect(actual).to.deep.equal(expected)
  })

  it('it can add a query', () => {
    const actual = reducer(state, addQuery())
    expect(actual.queryIDs.length).to.equal(1)
  })

  it('it can delete a query', () => {
    const queryID = '123'
    state = {queryIDs: ['456', queryID]}

    const actual = reducer(state, deleteQuery(queryID))
    const expected = {
      queryIDs: ['456'],
    }

    expect(actual).to.deep.equal(expected)
  })

  it('can summon the overlay technology to write data', () => {
    const actual = reducer(state, showWriteForm())
    expect(actual.showWriteForm).to.equal(true)
  })

  it('can banish overlay technology', () => {
    const actual = reducer(state, hideWriteForm())
    expect(actual.showWriteForm).to.equal(false)
  })
})

@@ -865,329 +865,8 @@
   %7D)
-%0A%0A  it('can summon the overlay technology to write data', () =%3E %7B%0A    const actual = reducer(state, showWriteForm())%0A    expect(actual.showWriteForm).to.equal(true)%0A  %7D)%0A%0A  it('can banish overlay technology', () =%3E %7B%0A    const actual = reducer(state, hideWriteForm())%0A    expect(actual.showWriteForm).to.equal(false)%0A  %7D)
 %0A%7D)%0A

remove tests for deleted reducer strings