|
|
@ -5,9 +5,8 @@ import reducer from 'console/reducers'; |
|
|
|
describe("console reducer", () => { |
|
|
|
describe("console reducer", () => { |
|
|
|
it('return the initial state', () => { |
|
|
|
it('return the initial state', () => { |
|
|
|
let state = reducer(undefined, {}); |
|
|
|
let state = reducer(undefined, {}); |
|
|
|
expect(state).to.have.property('errorShown', false); |
|
|
|
expect(state).to.have.property('mode', ''); |
|
|
|
expect(state).to.have.property('errorText', ''); |
|
|
|
expect(state).to.have.property('messageText', ''); |
|
|
|
expect(state).to.have.property('commandShown', false); |
|
|
|
|
|
|
|
expect(state).to.have.property('commandText', ''); |
|
|
|
expect(state).to.have.property('commandText', ''); |
|
|
|
expect(state).to.have.deep.property('completions', []); |
|
|
|
expect(state).to.have.deep.property('completions', []); |
|
|
|
expect(state).to.have.property('groupSelection', -1); |
|
|
|
expect(state).to.have.property('groupSelection', -1); |
|
|
@ -17,24 +16,24 @@ describe("console reducer", () => { |
|
|
|
it('return next state for CONSOLE_SHOW_COMMAND', () => { |
|
|
|
it('return next state for CONSOLE_SHOW_COMMAND', () => { |
|
|
|
let action = { type: actions.CONSOLE_SHOW_COMMAND, text: 'open ' }; |
|
|
|
let action = { type: actions.CONSOLE_SHOW_COMMAND, text: 'open ' }; |
|
|
|
let state = reducer({}, action); |
|
|
|
let state = reducer({}, action); |
|
|
|
expect(state).to.have.property('commandShown', true); |
|
|
|
expect(state).to.have.property('mode', 'command'); |
|
|
|
expect(state).to.have.property('commandText', 'open '); |
|
|
|
expect(state).to.have.property('commandText', 'open '); |
|
|
|
expect(state).to.have.property('errorShown', false); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('return next state for CONSOLE_SHOW_ERROR', () => { |
|
|
|
it('return next state for CONSOLE_SHOW_ERROR', () => { |
|
|
|
let action = { type: actions.CONSOLE_SHOW_ERROR, text: 'an error' }; |
|
|
|
let action = { type: actions.CONSOLE_SHOW_ERROR, text: 'an error' }; |
|
|
|
let state = reducer({}, action); |
|
|
|
let state = reducer({}, action); |
|
|
|
expect(state).to.have.property('errorShown', true); |
|
|
|
expect(state).to.have.property('mode', 'error'); |
|
|
|
expect(state).to.have.property('errorText', 'an error'); |
|
|
|
expect(state).to.have.property('messageText', 'an error'); |
|
|
|
expect(state).to.have.property('commandShown', false); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('return next state for CONSOLE_HIDE', () => { |
|
|
|
it('return next state for CONSOLE_HIDE_COMMAND', () => { |
|
|
|
let action = { type: actions.CONSOLE_HIDE }; |
|
|
|
let action = { type: actions.CONSOLE_HIDE_COMMAND }; |
|
|
|
let state = reducer({}, action); |
|
|
|
let state = reducer({ mode: 'command' }, action); |
|
|
|
expect(state).to.have.property('errorShown', false); |
|
|
|
expect(state).to.have.property('mode', ''); |
|
|
|
expect(state).to.have.property('commandShown', false); |
|
|
|
|
|
|
|
|
|
|
|
state = reducer({ mode: 'error' }, action); |
|
|
|
|
|
|
|
expect(state).to.have.property('mode', 'error'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it ('return next state for CONSOLE_SET_COMPLETIONS', () => { |
|
|
|
it ('return next state for CONSOLE_SET_COMPLETIONS', () => { |
|
|
|