@@ -9,17 +9,34 @@ import { setupStore } from "rootRedux/store";
9
9
import { persistedDefaultState } from "rootRedux/testTypes" ;
10
10
11
11
jest . mock ( "backend" , ( ) => ( {
12
+ cancelExport : jest . fn ,
12
13
deleteLift : jest . fn ,
13
14
downloadLift : ( ...args : any [ ] ) => mockDownloadList ( ...args ) ,
14
15
exportLift : ( ...args : any [ ] ) => mockExportLift ( ...args ) ,
15
16
} ) ) ;
16
- jest . mock ( "components/Project/ProjectActions" , ( ) => ( { } ) ) ;
17
17
18
18
const mockDownloadList = jest . fn ( ) ;
19
19
const mockExportLift = jest . fn ( ) ;
20
20
const mockProjId = "project-id" ;
21
21
22
22
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
+
23
40
describe ( "asyncDownloadExport" , ( ) => {
24
41
it ( "correctly affects state on success" , async ( ) => {
25
42
const store = setupStore ( ) ;
0 commit comments