1+ // eslint-disable-next-line no-unused-vars
12import React from 'react' ;
23import { render , screen , waitFor } from '@testing-library/react' ;
34import '@testing-library/jest-dom/extend-expect' ;
@@ -8,8 +9,6 @@ import configureStore from 'redux-mock-store';
89import WBS from './wbs' ;
910import { setWBSStart , setWBS } from '../../../actions/wbs' ;
1011
11-
12-
1312jest . mock ( '../../../actions/wbs' , ( ) => ( {
1413 addNewWBS : jest . fn ( ) ,
1514 fetchAllWBS : jest . fn ( ) ,
@@ -45,7 +44,7 @@ describe('WBS Component', () => {
4544 frontPermissions : [ 'deleteWbs' , 'addWbs' , 'fetchAllWBS' ] ,
4645 backPermissions : [ ] ,
4746 } ,
48- role : " Manager" ,
47+ role : ' Manager' ,
4948 } ,
5049 } ,
5150 role : { roles : [ ] } ,
@@ -74,6 +73,7 @@ describe('WBS Component', () => {
7473 } ) ;
7574
7675 it ( 'dispatches setWBSStart and setWBS when fetchAllWBS is called on mount' , async ( ) => {
76+ jest . setTimeout ( 10000 ) ;
7777 const mockWBSData = [ { _id : 'wbs1' , wbsName : 'WBS 1' } ] ;
7878 axios . get . mockResolvedValueOnce ( { data : mockWBSData } ) ;
7979
@@ -82,11 +82,11 @@ describe('WBS Component', () => {
8282 expect ( store . dispatch ) . toHaveBeenCalledWith ( setWBSStart ( ) ) ;
8383
8484 await waitFor ( ( ) => {
85+ expect ( store . dispatch ) . toHaveBeenCalledWith ( setWBSStart ( ) ) ;
8586 expect ( store . dispatch ) . toHaveBeenCalledWith ( setWBS ( mockWBSData ) ) ;
8687 } ) ;
8788 } ) ;
8889
89-
9090 it ( 'renders AddWBS component' , ( ) => {
9191 renderComponent ( ) ;
9292 expect ( screen . getByTestId ( 'add-wbs' ) ) . toBeInTheDocument ( ) ;
@@ -114,5 +114,4 @@ describe('WBS Component', () => {
114114 expect ( screen . getByText ( '#' ) ) . toBeInTheDocument ( ) ;
115115 expect ( screen . getByText ( 'Name' ) ) . toBeInTheDocument ( ) ;
116116 } ) ;
117-
118- } ) ;
117+ } ) ;
0 commit comments