@@ -6,6 +6,7 @@ import { SubstractDatePipe } from 'src/app/modules/shared/pipes/substract-date/s
66import { getReportDataSource } from 'src/app/modules/time-clock/store/entry.selectors' ;
77import { EntryState } from '../../../time-clock/store/entry.reducer' ;
88import { TimeEntriesTableComponent } from './time-entries-table.component' ;
9+ import { TotalHours } from '../../models/total-hours-report' ;
910
1011describe ( 'Reports Page' , ( ) => {
1112 describe ( 'TimeEntriesTableComponent' , ( ) => {
@@ -29,6 +30,31 @@ describe('Reports Page', () => {
2930 project_name : 'Time-Tracker' ,
3031 } ;
3132
33+ const timeEntryList : Entry [ ] = [
34+ {
35+ id : '123' ,
36+ start_date : new Date ( '2022-04-24T11:30:00Z' ) ,
37+ end_date : new Date ( '2022-04-24T14:30:00Z' ) ,
38+ activity_id : '123' ,
39+ technologies : [ 'react' , 'redux' ] ,
40+ description : 'any comment' ,
41+ uri : 'custom uri' ,
42+ project_id : '123' ,
43+ project_name : 'Time-Tracker' ,
44+ } ,
45+ {
46+ id : '456' ,
47+ start_date : new Date ( '2022-04-25T12:40:00Z' ) ,
48+ end_date : new Date ( '2022-04-25T13:00:00Z' ) ,
49+ activity_id : '123' ,
50+ technologies : [ 'react' , 'redux' ] ,
51+ description : 'any comment' ,
52+ uri : 'custom uri' ,
53+ project_id : '123' ,
54+ project_name : 'Time-Tracker' ,
55+ }
56+ ] ;
57+
3258 const state : EntryState = {
3359 active : timeEntry ,
3460 isLoading : false ,
@@ -123,18 +149,18 @@ describe('Reports Page', () => {
123149 const column = 3 ;
124150 expect ( component . bodyExportOptions ( durationTime , row , column , node ) ) . toMatch ( decimalValidator ) ;
125151 } ) ;
126-
152+
127153 it ( 'The data should not be displayed as a multiple of hour when column is different of 3' , ( ) => {
128154 const column = 4 ;
129155 expect ( component . bodyExportOptions ( durationTime , row , column , node ) ) . toBe ( durationTime . toString ( ) ) ;
130156 } ) ;
131-
157+
132158 it ( 'The link Ticket must not contain the ticket URL enclosed with < > when export a file csv, excel or PDF' , ( ) => {
133159 const entry = '<a _ngcontent-vlm-c151="" class="is-url">https://TT-392-uri</a>' ;
134160 const column = 0 ;
135161 expect ( component . bodyExportOptions ( entry , row , column , node ) ) . toBe ( 'https://TT-392-uri' ) ;
136162 } ) ;
137-
163+
138164 it ( 'when the rerenderDataTable method is called and dtElement and dtInstance are defined, the destroy and next methods are called ' ,
139165 ( ) => {
140166 component . dtElement = {
@@ -146,6 +172,11 @@ describe('Reports Page', () => {
146172 component . ngAfterViewInit ( ) ;
147173 expect ( component . dtElement . dtInstance . then ) . toHaveBeenCalled ( ) ;
148174 } ) ;
175+
176+ it ( 'The sum of the data dates is equal to {"hours": 3, "minutes":20,"seconds":0}' , ( ) => {
177+ let { hours, minutes, seconds} : TotalHours = component . sumDates ( timeEntryList ) ;
178+ expect ( { hours, minutes, seconds} ) . toEqual ( { hours :3 , minutes :20 , seconds :0 } ) ;
179+ } ) ;
149180
150181 afterEach ( ( ) => {
151182 fixture . destroy ( ) ;
0 commit comments