@@ -7,6 +7,7 @@ import { SubstractDatePipe } from 'src/app/modules/shared/pipes/substract-date/s
77import { getReportDataSource } from 'src/app/modules/time-clock/store/entry.selectors' ;
88import { EntryState } from '../../../time-clock/store/entry.reducer' ;
99import { TimeEntriesTableComponent } from './time-entries-table.component' ;
10+ import { ActionsSubject } from '@ngrx/store' ;
1011
1112describe ( 'Reports Page' , ( ) => {
1213 describe ( 'TimeEntriesTableComponent' , ( ) => {
@@ -47,25 +48,28 @@ describe('Reports Page', () => {
4748 } ,
4849 } ;
4950
51+ const actionSub : ActionsSubject = new ActionsSubject ( ) ;
52+
5053 beforeEach (
5154 waitForAsync ( ( ) => {
5255 TestBed . configureTestingModule ( {
5356 imports : [ NgxPaginationModule , DataTablesModule ] ,
5457 declarations : [ TimeEntriesTableComponent , SubstractDatePipe ] ,
55- providers : [ provideMockStore ( { initialState : state } ) ] ,
58+ providers : [ provideMockStore ( { initialState : state } ) , { provide : ActionsSubject , useValue : actionSub } ] ,
5659 } ) . compileComponents ( ) ;
57- store = TestBed . inject ( MockStore ) ;
60+
5861 } )
5962 ) ;
6063
6164 beforeEach (
62- waitForAsync ( ( ) => {
65+ ( ) => {
6366 fixture = TestBed . createComponent ( TimeEntriesTableComponent ) ;
6467 component = fixture . componentInstance ;
68+ store = TestBed . inject ( MockStore ) ;
6569 store . setState ( state ) ;
6670 getReportDataSourceSelectorMock = store . overrideSelector ( getReportDataSource , state . reportDataSource ) ;
6771 fixture . detectChanges ( ) ;
68- } )
72+ }
6973 ) ;
7074
7175 beforeEach ( ( ) => {
@@ -140,9 +144,13 @@ describe('Reports Page', () => {
140144
141145 it ( 'when the rerenderDataTable method is called and dtElement and dtInstance are defined, the destroy and next methods are called ' ,
142146 ( ) => {
143- spyOn ( component . dtElement . dtInstance , 'then' ) ;
147+ spyOn ( component . dtTrigger , 'next' ) ;
148+
144149 component . ngAfterViewInit ( ) ;
145- expect ( component . dtElement . dtInstance . then ) . toHaveBeenCalled ( ) ;
150+
151+ component . dtElement . dtInstance . then ( ( dtInstance ) => {
152+ expect ( component . dtTrigger . next ) . toHaveBeenCalled ( ) ;
153+ } ) ;
146154 } ) ;
147155
148156 it ( `When the user method is called, the emit method is called` , ( ) => {
0 commit comments