Skip to content

Commit 6600a2e

Browse files
committed
testing export status upon cancel
1 parent 9ebba21 commit 6600a2e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/components/ProjectExport/Redux/tests/ExportProjectActions.test.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,34 @@ import { setupStore } from "rootRedux/store";
99
import { persistedDefaultState } from "rootRedux/testTypes";
1010

1111
jest.mock("backend", () => ({
12+
cancelExport: jest.fn,
1213
deleteLift: jest.fn,
1314
downloadLift: (...args: any[]) => mockDownloadList(...args),
1415
exportLift: (...args: any[]) => mockExportLift(...args),
1516
}));
16-
jest.mock("components/Project/ProjectActions", () => ({}));
1717

1818
const mockDownloadList = jest.fn();
1919
const mockExportLift = jest.fn();
2020
const mockProjId = "project-id";
2121

2222
describe("ExportProjectActions", () => {
23+
describe("asyncCancelExport", () => {
24+
it("correctly affects state", async () => {
25+
const nonDefaultState = {
26+
projectId: "nonempty-string",
27+
status: ExportStatus.Success,
28+
};
29+
const store = setupStore({
30+
...persistedDefaultState,
31+
exportProjectState: nonDefaultState,
32+
});
33+
await store.dispatch(asyncCancelExport(nonDefaultState.projectId));
34+
const { projectId, status } = store.getState().exportProjectState;
35+
expect(projectId).toEqual("");
36+
expect(status).toEqual(ExportStatus.Default);
37+
});
38+
});
39+
2340
describe("asyncDownloadExport", () => {
2441
it("correctly affects state on success", async () => {
2542
const store = setupStore();

0 commit comments

Comments
 (0)