aboutsummaryrefslogtreecommitdiff
path: root/test/console
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 20:01:57 +0900
committerGitHub <noreply@github.com>2017-10-08 20:01:57 +0900
commit8b9125871b59d915324176ab959bb0aed20a727a (patch)
treea10db125bd25c1447bb08de2ef156c010243f019 /test/console
parentbbf90e77e99846c970118744066fbc21006761b5 (diff)
parent7ac00fce6f6c431f96c531179c6af3796df7e07a (diff)
Merge pull request #24 from ueokande/yank-url
Yank url
Diffstat (limited to 'test/console')
-rw-r--r--test/console/actions/console.test.js14
-rw-r--r--test/console/reducers/console.test.js32
2 files changed, 30 insertions, 16 deletions
diff --git a/test/console/actions/console.test.js b/test/console/actions/console.test.js
index dd04c85..3b02d4a 100644
--- a/test/console/actions/console.test.js
+++ b/test/console/actions/console.test.js
@@ -11,6 +11,14 @@ describe("console actions", () => {
});
});
+ describe("showInfo", () => {
+ it('create CONSOLE_SHOW_INFO action', () => {
+ let action = consoleActions.showInfo('an info');
+ expect(action.type).to.equal(actions.CONSOLE_SHOW_INFO);
+ expect(action.text).to.equal('an info');
+ });
+ });
+
describe("showError", () => {
it('create CONSOLE_SHOW_ERROR action', () => {
let action = consoleActions.showError('an error');
@@ -20,9 +28,9 @@ describe("console actions", () => {
});
describe("hide", () => {
- it('create CONSOLE_HIDE action', () => {
- let action = consoleActions.hide();
- expect(action.type).to.equal(actions.CONSOLE_HIDE);
+ it('create CONSOLE_HIDE_COMMAND action', () => {
+ let action = consoleActions.hideCommand();
+ expect(action.type).to.equal(actions.CONSOLE_HIDE_COMMAND);
});
});
diff --git a/test/console/reducers/console.test.js b/test/console/reducers/console.test.js
index 95ac993..4f85e55 100644
--- a/test/console/reducers/console.test.js
+++ b/test/console/reducers/console.test.js
@@ -5,9 +5,8 @@ import reducer from 'console/reducers';
describe("console reducer", () => {
it('return the initial state', () => {
let state = reducer(undefined, {});
- expect(state).to.have.property('errorShown', false);
- expect(state).to.have.property('errorText', '');
- expect(state).to.have.property('commandShown', false);
+ expect(state).to.have.property('mode', '');
+ expect(state).to.have.property('messageText', '');
expect(state).to.have.property('commandText', '');
expect(state).to.have.deep.property('completions', []);
expect(state).to.have.property('groupSelection', -1);
@@ -17,24 +16,31 @@ describe("console reducer", () => {
it('return next state for CONSOLE_SHOW_COMMAND', () => {
let action = { type: actions.CONSOLE_SHOW_COMMAND, text: 'open ' };
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('errorShown', false);
+ });
+
+ it('return next state for CONSOLE_SHOW_INFO', () => {
+ let action = { type: actions.CONSOLE_SHOW_INFO, text: 'an info' };
+ let state = reducer({}, action);
+ expect(state).to.have.property('mode', 'info');
+ expect(state).to.have.property('messageText', 'an info');
});
it('return next state for CONSOLE_SHOW_ERROR', () => {
let action = { type: actions.CONSOLE_SHOW_ERROR, text: 'an error' };
let state = reducer({}, action);
- expect(state).to.have.property('errorShown', true);
- expect(state).to.have.property('errorText', 'an error');
- expect(state).to.have.property('commandShown', false);
+ expect(state).to.have.property('mode', 'error');
+ expect(state).to.have.property('messageText', 'an error');
});
- it('return next state for CONSOLE_HIDE', () => {
- let action = { type: actions.CONSOLE_HIDE };
- let state = reducer({}, action);
- expect(state).to.have.property('errorShown', false);
- expect(state).to.have.property('commandShown', false);
+ it('return next state for CONSOLE_HIDE_COMMAND', () => {
+ let action = { type: actions.CONSOLE_HIDE_COMMAND };
+ let state = reducer({ mode: 'command' }, action);
+ expect(state).to.have.property('mode', '');
+
+ state = reducer({ mode: 'error' }, action);
+ expect(state).to.have.property('mode', 'error');
});
it ('return next state for CONSOLE_SET_COMPLETIONS', () => {