aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-11-07 21:20:22 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-11-11 16:16:01 +0900
commit956dd937d33d167440d9d637f67ebff5d72353e5 (patch)
treea18ccd23c329f83d8a98868196dbeeec62cf63d6 /test
parente1c70769ea235a78da463ab21de40582381bec78 (diff)
console as redux architecture
Diffstat (limited to 'test')
-rw-r--r--test/console/actions/console.test.js14
-rw-r--r--test/console/reducers/console.test.js10
2 files changed, 21 insertions, 3 deletions
diff --git a/test/console/actions/console.test.js b/test/console/actions/console.test.js
index c96dd99..9af13d4 100644
--- a/test/console/actions/console.test.js
+++ b/test/console/actions/console.test.js
@@ -34,17 +34,26 @@ describe("console actions", () => {
});
});
- describe("hide", () => {
+ describe("hideCommand", () => {
it('create CONSOLE_HIDE_COMMAND action', () => {
let action = consoleActions.hideCommand();
expect(action.type).to.equal(actions.CONSOLE_HIDE_COMMAND);
});
});
+ describe('setConsoleText', () => {
+ it('create CONSOLE_SET_CONSOLE_TEXT action', () => {
+ let action = consoleActions.setConsoleText('hello world');
+ expect(action.type).to.equal(actions.CONSOLE_SET_CONSOLE_TEXT);
+ expect(action.consoleText).to.equal('hello world');
+ });
+ });
+
describe("setCompletions", () => {
it('create CONSOLE_SET_COMPLETIONS action', () => {
- let action = consoleActions.setCompletions([1,2,3]);
+ let action = consoleActions.setCompletions('query', [1, 2, 3]);
expect(action.type).to.equal(actions.CONSOLE_SET_COMPLETIONS);
+ expect(action.completionSource).to.deep.equal('query');
expect(action.completions).to.deep.equal([1, 2, 3]);
});
});
@@ -63,4 +72,3 @@ describe("console actions", () => {
});
});
});
-
diff --git a/test/console/reducers/console.test.js b/test/console/reducers/console.test.js
index 280d1b7..438d513 100644
--- a/test/console/reducers/console.test.js
+++ b/test/console/reducers/console.test.js
@@ -43,6 +43,16 @@ describe("console reducer", () => {
expect(state).to.have.property('mode', 'error');
});
+ it('return next state for CONSOLE_SET_CONSOLE_TEXT', () => {
+ let action = {
+ type: actions.CONSOLE_SET_CONSOLE_TEXT,
+ consoleText: 'hello world'
+ }
+ let state = reducer({}, action)
+
+ expect(state).to.have.property('consoleText', 'hello world');
+ });
+
it ('return next state for CONSOLE_SET_COMPLETIONS', () => {
let state = {
groupSelection: 0,