From d5986dd7974f2b4b11510fea4d7bf4f04cf3fd6b Mon Sep 17 00:00:00 2001 From: tsuchiyama-araya Date: Wed, 4 Dec 2024 16:13:59 +0900 Subject: [PATCH] Added copyExperimentByList --- .../slice/Experiments/Experiments.test.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/frontend/src/store/slice/Experiments/Experiments.test.ts b/frontend/src/store/slice/Experiments/Experiments.test.ts index ddd3705fa..47904cfc2 100644 --- a/frontend/src/store/slice/Experiments/Experiments.test.ts +++ b/frontend/src/store/slice/Experiments/Experiments.test.ts @@ -1,6 +1,7 @@ import { expect, describe, test } from "@jest/globals" import { + copyExperimentByList, deleteExperimentByList, deleteExperimentByUid, getExperiments, @@ -215,4 +216,57 @@ describe("Experiments", () => { targetState.status === "fulfilled" && targetState.experimentList, ).toEqual({}) }) + + test(copyExperimentByList.fulfilled.type, () => { + const prevState = reducer( + reducer(initialState, getExperimentsPendingAction), + getExperimentsFulfilledAction, + ) + const copyExperimentByListFulfilledAction = { + type: copyExperimentByList.fulfilled.type, + payload: true, + meta: { + arg: [uid1, uid2], + requestId: "faNrL5ZV3SRODugFlJM20", + requestStatus: "fulfilled", + }, + } + const targetState = reducer(prevState, copyExperimentByListFulfilledAction) + expect(targetState.loading).toBe(false) + }) + + test(copyExperimentByList.pending.type, () => { + const prevState = reducer( + reducer(initialState, getExperimentsPendingAction), + getExperimentsFulfilledAction, + ) + const copyExperimentByListPendingAction = { + type: copyExperimentByList.pending.type, + meta: { + arg: [uid1, uid2], + requestId: "faNrL5ZV3SRODugFlJM20", + requestStatus: "pending", + }, + } + const targetState = reducer(prevState, copyExperimentByListPendingAction) + expect(targetState.loading).toBe(true) + }) + + test(copyExperimentByList.rejected.type, () => { + const prevState = reducer( + reducer(initialState, getExperimentsPendingAction), + getExperimentsFulfilledAction, + ) + const copyExperimentByListRejectedAction = { + type: copyExperimentByList.rejected.type, + payload: false, + meta: { + arg: [uid1, uid2], + requestId: "faNrL5ZV3SRODugFlJM20", + requestStatus: "rejected", + }, + } + const targetState = reducer(prevState, copyExperimentByListRejectedAction) + expect(targetState.loading).toBe(false) + }) })