Skip to content

Commit

Permalink
Added copyExperimentByList
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuchiyama-araya committed Dec 4, 2024
1 parent 5c9f385 commit d5986dd
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions frontend/src/store/slice/Experiments/Experiments.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, describe, test } from "@jest/globals"

import {
copyExperimentByList,
deleteExperimentByList,
deleteExperimentByUid,
getExperiments,
Expand Down Expand Up @@ -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)
})
})

0 comments on commit d5986dd

Please sign in to comment.