diff options
Diffstat (limited to 'test/console/reducers')
-rw-r--r-- | test/console/reducers/completion.test.ts | 102 | ||||
-rw-r--r-- | test/console/reducers/console.test.ts | 11 |
2 files changed, 0 insertions, 113 deletions
diff --git a/test/console/reducers/completion.test.ts b/test/console/reducers/completion.test.ts deleted file mode 100644 index 6c76369..0000000 --- a/test/console/reducers/completion.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import reducer, { State } from "../../../src/console/reducers/completion"; -import { expect } from "chai"; -import { - COMPLETION_COMPLETION_NEXT, - COMPLETION_COMPLETION_PREV, - COMPLETION_SET_COMPLETIONS, - CompletionAction, -} from "../../../src/console/actions/completion"; - -describe("completion reducer", () => { - it("return next state for CONSOLE_SET_COMPLETIONS", () => { - const initialState = reducer(undefined, {} as any); - let state: State = { - ...initialState, - select: 0, - completions: [], - }; - const action: CompletionAction = { - type: COMPLETION_SET_COMPLETIONS, - completions: [ - { - name: "Apple", - items: [{}, {}, {}], - }, - { - name: "Banana", - items: [{}, {}, {}], - }, - ], - completionSource: "", - }; - state = reducer(state, action); - expect(state).to.have.property("completions", action.completions); - expect(state).to.have.property("select", -1); - }); - - it("return next state for CONSOLE_COMPLETION_NEXT", () => { - const initialState = reducer(undefined, {} as any); - const action: CompletionAction = { - type: COMPLETION_COMPLETION_NEXT, - }; - let state = { - ...initialState, - select: -1, - completions: [ - { - name: "Apple", - items: [{}, {}], - }, - { - name: "Banana", - items: [{}], - }, - ], - }; - - state = reducer(state, action); - expect(state).to.have.property("select", 0); - - state = reducer(state, action); - expect(state).to.have.property("select", 1); - - state = reducer(state, action); - expect(state).to.have.property("select", 2); - - state = reducer(state, action); - expect(state).to.have.property("select", -1); - }); - - it("return next state for CONSOLE_COMPLETION_PREV", () => { - const initialState = reducer(undefined, {} as any); - const action: CompletionAction = { - type: COMPLETION_COMPLETION_PREV, - }; - let state = { - ...initialState, - select: -1, - completions: [ - { - name: "Apple", - items: [{}, {}], - }, - { - name: "Banana", - items: [{}], - }, - ], - }; - - state = reducer(state, action); - expect(state).to.have.property("select", 2); - - state = reducer(state, action); - expect(state).to.have.property("select", 1); - - state = reducer(state, action); - expect(state).to.have.property("select", 0); - - state = reducer(state, action); - expect(state).to.have.property("select", -1); - }); -}); diff --git a/test/console/reducers/console.test.ts b/test/console/reducers/console.test.ts index 4d4859d..390dc66 100644 --- a/test/console/reducers/console.test.ts +++ b/test/console/reducers/console.test.ts @@ -3,7 +3,6 @@ import { expect } from "chai"; import { CONSOLE_HIDE, CONSOLE_HIDE_COMMAND, - CONSOLE_SET_CONSOLE_TEXT, CONSOLE_SHOW_COMMAND, CONSOLE_SHOW_ERROR, CONSOLE_SHOW_INFO, @@ -66,14 +65,4 @@ describe("console reducer", () => { state = reducer({ ...initialState, mode: "error" }, action); expect(state).to.have.property("mode", "error"); }); - - it("return next state for CONSOLE_SET_CONSOLE_TEXT", () => { - const action: ConsoleAction = { - type: CONSOLE_SET_CONSOLE_TEXT, - consoleText: "hello world", - }; - const state = reducer(undefined, action); - - expect(state).to.have.property("consoleText", "hello world"); - }); }); |