aboutsummaryrefslogtreecommitdiff
path: root/test/console/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-04-11 18:00:51 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-04-11 22:34:14 +0900
commit618fb497c443662531eb3befe7696a04efe9651d (patch)
tree530af78bf75f03e7ffd71e4ca5ad1cf864584be0 /test/console/reducers
parent21f863d76fbb5ed752ad529f8fbe33e75460027e (diff)
Replace completion state with Custom Hooks
Diffstat (limited to 'test/console/reducers')
-rw-r--r--test/console/reducers/completion.test.ts102
-rw-r--r--test/console/reducers/console.test.ts11
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");
- });
});