text: /* eslint-env mocha */
  import App from '../'
  import assert from 'assert'
  
  describe('DEPRECATED state', () => {
    it('should be able to GET state', () => {
      const rootModule = {
        state: {
          foo: 'bar',
        },
        sequences: {
          foo: [({ state }) => assert.deepEqual(state.get(), { foo: 'bar' })],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
    })
    it('should be able to SET state', () => {
      const rootModule = {
        state: {
          foo: 'bar',
        },
        sequences: {
          foo: [({ state }) => state.set('foo', 'bar2')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: 'bar2' })
    })
    it('should be able to SET state with an array in the path', () => {
      const rootModule = {
        state: { foo: ['bar'] },
        sequences: {
          foo: [({ state }) => state.set('foo.0', 'baz')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['baz'] })
    })
    it('should be able to TOGGLE state', () => {
      const rootModule = {
        state: { foo: false },
        sequences: {
          foo: [({ state }) => state.toggle('foo')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: true })
    })
    it('should be able to PUSH state', () => {
      const rootModule = {
        state: {
          foo: ['foo'],
        },
        sequences: {
          foo: [({ state }) => state.push('foo', 'bar')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['foo', 'bar'] })
    })
    it('should be able to MERGE state', () => {
      const rootModule = {
        state: {
          foo: { foo: 'bar' },
        },
        sequences: {
          foo: [({ state }) => state.merge('foo', { foo2: 'bar2' })],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), {
        foo: { foo: 'bar', foo2: 'bar2' },
      })
    })
    it('should be able to POP state', () => {
      const rootModule = {
        state: {
          foo: ['foo', 'bar'],
        },
        sequences: {
          foo: [({ state }) => state.pop('foo')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['foo'] })
    })
    it('should be able to SHIFT state', () => {
      const rootModule = {
        state: {
          foo: ['foo', 'bar'],
        },
        sequences: {
          foo: [({ state }) => state.shift('foo')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['bar'] })
    })
    it('should be able to UNSHIFT state', () => {
      const rootModule = {
        state: {
          foo: ['foo'],
        },
        sequences: {
          foo: [({ state }) => state.unshift('foo', 'bar')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['bar', 'foo'] })
    })
    it('should be able to SPLICE state', () => {
      const rootModule = {
        state: {
          foo: ['foo'],
        },
        sequences: {
          foo: [({ state }) => state.splice('foo', 0, 1, 'bar')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['bar'] })
    })
    it('should be able to UNSET state', () => {
      const rootModule = {
        state: {
          foo: 'bar',
        },
        sequences: {
          foo: [({ state }) => state.unset('foo')],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), {})
    })
    it('should be able to CONCAT state', () => {
      const rootModule = {
        state: {
          foo: ['foo'],
        },
        sequences: {
          foo: [({ state }) => state.concat('foo', ['bar'])],
        },
      }
      const controller = App(rootModule)
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['foo', 'bar'] })
    })
    it('should provide a descriptive error when passing invalid value to state', () => {
      const rootModule = {
        state: {
          foo: '',
        },
        sequences: {
          foo: [({ state }) => state.set('foo', () => {})],
        },
      }
      const controller = App(rootModule, {
        devtools: { init() {}, sendExecutionData() {} },
      })
      assert.throws(() => {
        controller.getSequence('foo')()
      }, Error)
    })
    it('should work with devtools', () => {
      const rootModule = {
        state: {
          foo: ['foo'],
        },
        sequences: {
          foo: [({ state }) => state.splice('foo', 0, 1, 'bar')],
        },
      }
      const controller = App(rootModule, {
        devtools: { init() {}, send() {}, sendExecutionData() {} },
      })
      controller.getSequence('foo')()
      assert.deepEqual(controller.getState(), { foo: ['bar'] })
    })
  })
  