aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/console/actions/console.test.js21
-rw-r--r--test/console/reducers/console.test.js14
-rw-r--r--test/content/reducers/find.test.js23
3 files changed, 53 insertions, 5 deletions
diff --git a/test/console/actions/console.test.js b/test/console/actions/console.test.js
index 3b02d4a..9af13d4 100644
--- a/test/console/actions/console.test.js
+++ b/test/console/actions/console.test.js
@@ -11,6 +11,13 @@ describe("console actions", () => {
});
});
+ describe("showFind", () => {
+ it('create CONSOLE_SHOW_FIND action', () => {
+ let action = consoleActions.showFind();
+ expect(action.type).to.equal(actions.CONSOLE_SHOW_FIND);
+ });
+ });
+
describe("showInfo", () => {
it('create CONSOLE_SHOW_INFO action', () => {
let action = consoleActions.showInfo('an info');
@@ -27,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]);
});
});
@@ -56,4 +72,3 @@ describe("console actions", () => {
});
});
});
-
diff --git a/test/console/reducers/console.test.js b/test/console/reducers/console.test.js
index 4f85e55..438d513 100644
--- a/test/console/reducers/console.test.js
+++ b/test/console/reducers/console.test.js
@@ -7,7 +7,7 @@ describe("console reducer", () => {
let state = reducer(undefined, {});
expect(state).to.have.property('mode', '');
expect(state).to.have.property('messageText', '');
- expect(state).to.have.property('commandText', '');
+ expect(state).to.have.property('consoleText', '');
expect(state).to.have.deep.property('completions', []);
expect(state).to.have.property('groupSelection', -1);
expect(state).to.have.property('itemSelection', -1);
@@ -17,7 +17,7 @@ describe("console reducer", () => {
let action = { type: actions.CONSOLE_SHOW_COMMAND, text: 'open ' };
let state = reducer({}, action);
expect(state).to.have.property('mode', 'command');
- expect(state).to.have.property('commandText', 'open ');
+ expect(state).to.have.property('consoleText', 'open ');
});
it('return next state for CONSOLE_SHOW_INFO', () => {
@@ -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,
diff --git a/test/content/reducers/find.test.js b/test/content/reducers/find.test.js
new file mode 100644
index 0000000..93625da
--- /dev/null
+++ b/test/content/reducers/find.test.js
@@ -0,0 +1,23 @@
+import { expect } from "chai";
+import actions from 'content/actions';
+import findReducer from 'content/reducers/find';
+
+describe("find reducer", () => {
+ it('return the initial state', () => {
+ let state = findReducer(undefined, {});
+ expect(state).to.have.property('keyword', '');
+ expect(state).to.have.property('found', false);
+ });
+
+ it('return next state for FIND_SET_KEYWORD', () => {
+ let action = {
+ type: actions.FIND_SET_KEYWORD,
+ keyword: 'xyz',
+ found: true,
+ };
+ let state = findReducer({}, action);
+
+ expect(state.keyword).is.equal('xyz');
+ expect(state.found).to.be.true;
+ });
+});