aboutsummaryrefslogtreecommitdiff
path: root/test/background
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-03-07 20:54:28 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-03-07 20:57:52 +0900
commit24e72aa6e079009d4c24c7f6be6bfb82c21e6643 (patch)
treef5b4d46b8809b0dd152e3124b7354f3b9da16fe2 /test/background
parent4923cb20c77e7cc84d8ecdf1b12ee6c204701e71 (diff)
add global find keyword
Diffstat (limited to 'test/background')
-rw-r--r--test/background/actions/find.test.js13
-rw-r--r--test/background/reducers/find.test.js19
2 files changed, 32 insertions, 0 deletions
diff --git a/test/background/actions/find.test.js b/test/background/actions/find.test.js
new file mode 100644
index 0000000..467604f
--- /dev/null
+++ b/test/background/actions/find.test.js
@@ -0,0 +1,13 @@
+import { expect } from "chai";
+import actions from 'background/actions';
+import * as findActions from 'background/actions/find';
+
+describe("find actions", () => {
+ describe("setKeyword", () => {
+ it('create FIND_SET_KEYWORD action', () => {
+ let action = findActions.setKeyword('banana');
+ expect(action.type).to.equal(actions.FIND_SET_KEYWORD);
+ expect(action.keyword).to.equal('banana');
+ });
+ });
+});
diff --git a/test/background/reducers/find.test.js b/test/background/reducers/find.test.js
new file mode 100644
index 0000000..707d73a
--- /dev/null
+++ b/test/background/reducers/find.test.js
@@ -0,0 +1,19 @@
+import { expect } from "chai";
+import actions from 'background/actions';
+import findReducer from 'background/reducers/find';
+
+describe("find reducer", () => {
+ it('return the initial state', () => {
+ let state = findReducer(undefined, {});
+ expect(state).to.have.deep.property('keyword', null);
+ });
+
+ it('return next state for FIND_SET_KEYWORD', () => {
+ let action = {
+ type: actions.FIND_SET_KEYWORD,
+ keyword: 'cherry',
+ };
+ let state = findReducer(undefined, action);
+ expect(state).to.have.deep.property('keyword', 'cherry')
+ });
+});