11import { waitForAsync , ComponentFixture , TestBed } from '@angular/core/testing' ;
2+ import { RouterLinkWithHref } from '@angular/router' ;
23import { MockStore , provideMockStore } from '@ngrx/store/testing' ;
34import { Entry } from 'src/app/modules/shared/models' ;
45import { SubstractDatePipe } from 'src/app/modules/shared/pipes/substract-date/substract-date.pipe' ;
@@ -13,6 +14,9 @@ describe('Reports Page', () => {
1314 let store : MockStore < EntryState > ;
1415 let getReportDataSourceSelectorMock ;
1516 let durationTime : number ;
17+ let row : number ;
18+ let node : number ;
19+ let decimalValidator : RegExp ;
1620 const timeEntry : Entry = {
1721 id : '123' ,
1822 start_date : new Date ( ) ,
@@ -65,6 +69,9 @@ describe('Reports Page', () => {
6569
6670 beforeEach ( ( ) => {
6771 durationTime = new Date ( ) . setHours ( 5 , 30 ) ;
72+ row = 0 ;
73+ node = 0 ;
74+ decimalValidator = / ^ \d + \. \d { 0 , 2 } $ / ;
6875 } ) ;
6976
7077 it ( 'component should be created' , async ( ) => {
@@ -113,11 +120,14 @@ describe('Reports Page', () => {
113120 } ) ;
114121
115122 it ( 'The data should be displayed as a multiple of hour when column is equal to 3' , ( ) => {
116- expect ( component . bodyExportOptions ( durationTime , 0 , 3 , 0 ) ) . toMatch ( / ^ \d + \. \d { 0 , 2 } $ / ) ;
123+ const column = 3 ;
124+
125+ expect ( component . bodyExportOptions ( durationTime , row , column , node ) ) . toMatch ( decimalValidator ) ;
117126 } ) ;
118127
119128 it ( 'The data should not be displayed as a multiple of hour when column is different of 3' , ( ) => {
120- expect ( component . bodyExportOptions ( durationTime , 0 , 4 , 0 ) ) . toBe ( durationTime ) ;
129+ const column = 4 ;
130+ expect ( component . bodyExportOptions ( durationTime , row , column , node ) ) . toBe ( durationTime ) ;
121131 } ) ;
122132
123133 afterEach ( ( ) => {
0 commit comments