From c60d0e7392fc708e961614d6b756a045de74f458 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 30 Apr 2019 14:00:07 +0900 Subject: Rename .js/.jsx to .ts/.tsx --- test/content/reducers/addon.test.js | 17 --------- test/content/reducers/addon.test.ts | 17 +++++++++ test/content/reducers/find.test.js | 22 ------------ test/content/reducers/find.test.ts | 22 ++++++++++++ test/content/reducers/follow-controller.test.js | 47 ------------------------- test/content/reducers/follow-controller.test.ts | 47 +++++++++++++++++++++++++ test/content/reducers/input.test.js | 25 ------------- test/content/reducers/input.test.ts | 25 +++++++++++++ test/content/reducers/mark.test.js | 41 --------------------- test/content/reducers/mark.test.ts | 41 +++++++++++++++++++++ test/content/reducers/setting.test.js | 17 --------- test/content/reducers/setting.test.ts | 17 +++++++++ 12 files changed, 169 insertions(+), 169 deletions(-) delete mode 100644 test/content/reducers/addon.test.js create mode 100644 test/content/reducers/addon.test.ts delete mode 100644 test/content/reducers/find.test.js create mode 100644 test/content/reducers/find.test.ts delete mode 100644 test/content/reducers/follow-controller.test.js create mode 100644 test/content/reducers/follow-controller.test.ts delete mode 100644 test/content/reducers/input.test.js create mode 100644 test/content/reducers/input.test.ts delete mode 100644 test/content/reducers/mark.test.js create mode 100644 test/content/reducers/mark.test.ts delete mode 100644 test/content/reducers/setting.test.js create mode 100644 test/content/reducers/setting.test.ts (limited to 'test/content/reducers') diff --git a/test/content/reducers/addon.test.js b/test/content/reducers/addon.test.js deleted file mode 100644 index d4eb845..0000000 --- a/test/content/reducers/addon.test.js +++ /dev/null @@ -1,17 +0,0 @@ -import actions from 'content/actions'; -import addonReducer from 'content/reducers/addon'; - -describe("addon reducer", () => { - it('return the initial state', () => { - let state = addonReducer(undefined, {}); - expect(state).to.have.property('enabled', true); - }); - - it('return next state for ADDON_SET_ENABLED', () => { - let action = { type: actions.ADDON_SET_ENABLED, enabled: true }; - let prev = { enabled: false }; - let state = addonReducer(prev, action); - - expect(state.enabled).is.equal(true); - }); -}); diff --git a/test/content/reducers/addon.test.ts b/test/content/reducers/addon.test.ts new file mode 100644 index 0000000..d4eb845 --- /dev/null +++ b/test/content/reducers/addon.test.ts @@ -0,0 +1,17 @@ +import actions from 'content/actions'; +import addonReducer from 'content/reducers/addon'; + +describe("addon reducer", () => { + it('return the initial state', () => { + let state = addonReducer(undefined, {}); + expect(state).to.have.property('enabled', true); + }); + + it('return next state for ADDON_SET_ENABLED', () => { + let action = { type: actions.ADDON_SET_ENABLED, enabled: true }; + let prev = { enabled: false }; + let state = addonReducer(prev, action); + + expect(state.enabled).is.equal(true); + }); +}); diff --git a/test/content/reducers/find.test.js b/test/content/reducers/find.test.js deleted file mode 100644 index a8c30d7..0000000 --- a/test/content/reducers/find.test.js +++ /dev/null @@ -1,22 +0,0 @@ -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', null); - 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; - }); -}); diff --git a/test/content/reducers/find.test.ts b/test/content/reducers/find.test.ts new file mode 100644 index 0000000..a8c30d7 --- /dev/null +++ b/test/content/reducers/find.test.ts @@ -0,0 +1,22 @@ +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', null); + 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; + }); +}); diff --git a/test/content/reducers/follow-controller.test.js b/test/content/reducers/follow-controller.test.js deleted file mode 100644 index 8a4c2d4..0000000 --- a/test/content/reducers/follow-controller.test.js +++ /dev/null @@ -1,47 +0,0 @@ -import actions from 'content/actions'; -import followControllerReducer from 'content/reducers/follow-controller'; - -describe('follow-controller reducer', () => { - it ('returns the initial state', () => { - let state = followControllerReducer(undefined, {}); - expect(state).to.have.property('enabled', false); - expect(state).to.have.property('newTab'); - expect(state).to.have.deep.property('keys', ''); - }); - - it ('returns next state for FOLLOW_CONTROLLER_ENABLE', () => { - let action = { type: actions.FOLLOW_CONTROLLER_ENABLE, newTab: true }; - let state = followControllerReducer({ enabled: false, newTab: false }, action); - expect(state).to.have.property('enabled', true); - expect(state).to.have.property('newTab', true); - expect(state).to.have.property('keys', ''); - }); - - it ('returns next state for FOLLOW_CONTROLLER_DISABLE', () => { - let action = { type: actions.FOLLOW_CONTROLLER_DISABLE }; - let state = followControllerReducer({ enabled: true }, action); - expect(state).to.have.property('enabled', false); - }); - - it ('returns next state for FOLLOW_CONTROLLER_KEY_PRESS', () => { - let action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'a'}; - let state = followControllerReducer({ keys: '' }, action); - expect(state).to.have.deep.property('keys', 'a'); - - action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'b'}; - state = followControllerReducer(state, action); - expect(state).to.have.deep.property('keys', 'ab'); - }); - - it ('returns next state for FOLLOW_CONTROLLER_BACKSPACE', () => { - let action = { type: actions.FOLLOW_CONTROLLER_BACKSPACE }; - let state = followControllerReducer({ keys: 'ab' }, action); - expect(state).to.have.deep.property('keys', 'a'); - - state = followControllerReducer(state, action); - expect(state).to.have.deep.property('keys', ''); - - state = followControllerReducer(state, action); - expect(state).to.have.deep.property('keys', ''); - }); -}); diff --git a/test/content/reducers/follow-controller.test.ts b/test/content/reducers/follow-controller.test.ts new file mode 100644 index 0000000..8a4c2d4 --- /dev/null +++ b/test/content/reducers/follow-controller.test.ts @@ -0,0 +1,47 @@ +import actions from 'content/actions'; +import followControllerReducer from 'content/reducers/follow-controller'; + +describe('follow-controller reducer', () => { + it ('returns the initial state', () => { + let state = followControllerReducer(undefined, {}); + expect(state).to.have.property('enabled', false); + expect(state).to.have.property('newTab'); + expect(state).to.have.deep.property('keys', ''); + }); + + it ('returns next state for FOLLOW_CONTROLLER_ENABLE', () => { + let action = { type: actions.FOLLOW_CONTROLLER_ENABLE, newTab: true }; + let state = followControllerReducer({ enabled: false, newTab: false }, action); + expect(state).to.have.property('enabled', true); + expect(state).to.have.property('newTab', true); + expect(state).to.have.property('keys', ''); + }); + + it ('returns next state for FOLLOW_CONTROLLER_DISABLE', () => { + let action = { type: actions.FOLLOW_CONTROLLER_DISABLE }; + let state = followControllerReducer({ enabled: true }, action); + expect(state).to.have.property('enabled', false); + }); + + it ('returns next state for FOLLOW_CONTROLLER_KEY_PRESS', () => { + let action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'a'}; + let state = followControllerReducer({ keys: '' }, action); + expect(state).to.have.deep.property('keys', 'a'); + + action = { type: actions.FOLLOW_CONTROLLER_KEY_PRESS, key: 'b'}; + state = followControllerReducer(state, action); + expect(state).to.have.deep.property('keys', 'ab'); + }); + + it ('returns next state for FOLLOW_CONTROLLER_BACKSPACE', () => { + let action = { type: actions.FOLLOW_CONTROLLER_BACKSPACE }; + let state = followControllerReducer({ keys: 'ab' }, action); + expect(state).to.have.deep.property('keys', 'a'); + + state = followControllerReducer(state, action); + expect(state).to.have.deep.property('keys', ''); + + state = followControllerReducer(state, action); + expect(state).to.have.deep.property('keys', ''); + }); +}); diff --git a/test/content/reducers/input.test.js b/test/content/reducers/input.test.js deleted file mode 100644 index 0011943..0000000 --- a/test/content/reducers/input.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import actions from 'content/actions'; -import inputReducer from 'content/reducers/input'; - -describe("input reducer", () => { - it('return the initial state', () => { - let state = inputReducer(undefined, {}); - expect(state).to.have.deep.property('keys', []); - }); - - it('return next state for INPUT_KEY_PRESS', () => { - let action = { type: actions.INPUT_KEY_PRESS, key: 'a' }; - let state = inputReducer(undefined, action); - expect(state).to.have.deep.property('keys', ['a']); - - action = { type: actions.INPUT_KEY_PRESS, key: 'b' }; - state = inputReducer(state, action); - expect(state).to.have.deep.property('keys', ['a', 'b']); - }); - - it('return next state for INPUT_CLEAR_KEYS', () => { - let action = { type: actions.INPUT_CLEAR_KEYS }; - let state = inputReducer({ keys: [1, 2, 3] }, action); - expect(state).to.have.deep.property('keys', []); - }); -}); diff --git a/test/content/reducers/input.test.ts b/test/content/reducers/input.test.ts new file mode 100644 index 0000000..0011943 --- /dev/null +++ b/test/content/reducers/input.test.ts @@ -0,0 +1,25 @@ +import actions from 'content/actions'; +import inputReducer from 'content/reducers/input'; + +describe("input reducer", () => { + it('return the initial state', () => { + let state = inputReducer(undefined, {}); + expect(state).to.have.deep.property('keys', []); + }); + + it('return next state for INPUT_KEY_PRESS', () => { + let action = { type: actions.INPUT_KEY_PRESS, key: 'a' }; + let state = inputReducer(undefined, action); + expect(state).to.have.deep.property('keys', ['a']); + + action = { type: actions.INPUT_KEY_PRESS, key: 'b' }; + state = inputReducer(state, action); + expect(state).to.have.deep.property('keys', ['a', 'b']); + }); + + it('return next state for INPUT_CLEAR_KEYS', () => { + let action = { type: actions.INPUT_CLEAR_KEYS }; + let state = inputReducer({ keys: [1, 2, 3] }, action); + expect(state).to.have.deep.property('keys', []); + }); +}); diff --git a/test/content/reducers/mark.test.js b/test/content/reducers/mark.test.js deleted file mode 100644 index 76efbf7..0000000 --- a/test/content/reducers/mark.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import actions from 'content/actions'; -import reducer from 'content/reducers/mark'; - -describe("mark reducer", () => { - it('return the initial state', () => { - let state = reducer(undefined, {}); - expect(state.setMode).to.be.false; - expect(state.jumpMode).to.be.false; - expect(state.marks).to.be.empty; - }); - - it('starts set mode', () => { - let action = { type: actions.MARK_START_SET }; - let state = reducer(undefined, action); - expect(state.setMode).to.be.true; - }); - - it('starts jump mode', () => { - let action = { type: actions.MARK_START_JUMP }; - let state = reducer(undefined, action); - expect(state.jumpMode).to.be.true; - }); - - it('cancels set and jump mode', () => { - let action = { type: actions.MARK_CANCEL }; - let state = reducer({ setMode: true }, action); - expect(state.setMode).to.be.false; - - state = reducer({ jumpMode: true }, action); - expect(state.jumpMode).to.be.false; - }); - - it('stores local mark', () => { - let action = { type: actions.MARK_SET_LOCAL, key: 'a', x: 20, y: 30}; - let state = reducer({ setMode: true }, action); - expect(state.setMode).to.be.false; - expect(state.marks['a']).to.be.an('object') - expect(state.marks['a'].x).to.equal(20) - expect(state.marks['a'].y).to.equal(30) - }); -}); diff --git a/test/content/reducers/mark.test.ts b/test/content/reducers/mark.test.ts new file mode 100644 index 0000000..76efbf7 --- /dev/null +++ b/test/content/reducers/mark.test.ts @@ -0,0 +1,41 @@ +import actions from 'content/actions'; +import reducer from 'content/reducers/mark'; + +describe("mark reducer", () => { + it('return the initial state', () => { + let state = reducer(undefined, {}); + expect(state.setMode).to.be.false; + expect(state.jumpMode).to.be.false; + expect(state.marks).to.be.empty; + }); + + it('starts set mode', () => { + let action = { type: actions.MARK_START_SET }; + let state = reducer(undefined, action); + expect(state.setMode).to.be.true; + }); + + it('starts jump mode', () => { + let action = { type: actions.MARK_START_JUMP }; + let state = reducer(undefined, action); + expect(state.jumpMode).to.be.true; + }); + + it('cancels set and jump mode', () => { + let action = { type: actions.MARK_CANCEL }; + let state = reducer({ setMode: true }, action); + expect(state.setMode).to.be.false; + + state = reducer({ jumpMode: true }, action); + expect(state.jumpMode).to.be.false; + }); + + it('stores local mark', () => { + let action = { type: actions.MARK_SET_LOCAL, key: 'a', x: 20, y: 30}; + let state = reducer({ setMode: true }, action); + expect(state.setMode).to.be.false; + expect(state.marks['a']).to.be.an('object') + expect(state.marks['a'].x).to.equal(20) + expect(state.marks['a'].y).to.equal(30) + }); +}); diff --git a/test/content/reducers/setting.test.js b/test/content/reducers/setting.test.js deleted file mode 100644 index 4e4c095..0000000 --- a/test/content/reducers/setting.test.js +++ /dev/null @@ -1,17 +0,0 @@ -import actions from 'content/actions'; -import settingReducer from 'content/reducers/setting'; - -describe("content setting reducer", () => { - it('return the initial state', () => { - let state = settingReducer(undefined, {}); - expect(state.keymaps).to.be.empty; - }); - - it('return next state for SETTING_SET', () => { - let newSettings = { red: 'apple', yellow: 'banana' }; - let action = { type: actions.SETTING_SET, value: newSettings }; - let state = settingReducer(undefined, action); - expect(state).to.deep.equal(newSettings); - expect(state).not.to.equal(newSettings); // assert deep copy - }); -}); diff --git a/test/content/reducers/setting.test.ts b/test/content/reducers/setting.test.ts new file mode 100644 index 0000000..4e4c095 --- /dev/null +++ b/test/content/reducers/setting.test.ts @@ -0,0 +1,17 @@ +import actions from 'content/actions'; +import settingReducer from 'content/reducers/setting'; + +describe("content setting reducer", () => { + it('return the initial state', () => { + let state = settingReducer(undefined, {}); + expect(state.keymaps).to.be.empty; + }); + + it('return next state for SETTING_SET', () => { + let newSettings = { red: 'apple', yellow: 'banana' }; + let action = { type: actions.SETTING_SET, value: newSettings }; + let state = settingReducer(undefined, action); + expect(state).to.deep.equal(newSettings); + expect(state).not.to.equal(newSettings); // assert deep copy + }); +}); -- cgit v1.2.3