From fb0d5a004ace6d408a4d6167dacb114a8ba1642b Mon Sep 17 00:00:00 2001 From: pccommen Date: Fri, 23 Aug 2024 11:38:12 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=9E=84=EC=8B=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20(CC-178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caecae/__tests__/FindGameTest/FindGameTest.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Caecae/__tests__/FindGameTest/FindGameTest.ts diff --git a/Caecae/__tests__/FindGameTest/FindGameTest.ts b/Caecae/__tests__/FindGameTest/FindGameTest.ts new file mode 100644 index 0000000..d295e38 --- /dev/null +++ b/Caecae/__tests__/FindGameTest/FindGameTest.ts @@ -0,0 +1,27 @@ +import { act } from "react"; +import { + initFindingGameState, + action, + findingGameReducer, +} from "../../src/jobs/FindingGame/FindingGameWork"; +import { Action } from "../../src/shared/Hyundux" +import createHynduxTester from "../../src/shared/Hyundux-test/Tester"; + +const tester = createHynduxTester(initFindingGameState, findingGameReducer); + +test("changShowingAnswer__action_index_1__result_1_true", () => { + const givenData = initFindingGameState.payload; + const whenData: Action = action.changeShowingAnswer(1); + const thenData = tester.makeThenPayload({ answerIndex: 1 }) + + tester.given(givenData).when(whenData).then(thenData, true); +}); + +test("changShowingAnswer__action_index_2__result_1_false", () => { + const givenData = initFindingGameState.payload; + const whenData: Action = action.changeShowingAnswer(2); + const thenData = tester.makeThenPayload({ answerIndex: 1 }) + + tester.given(givenData).when(whenData).then(thenData, false); +}); +