@@ -55,9 +55,10 @@ describe('EntryService', () => {
55
55
56
56
it ( 'load all Entries' , ( ) => {
57
57
const month = new Date ( ) . getMonth ( ) ;
58
+ const timezoneOffset = new Date ( ) . getTimezoneOffset ( ) ;
58
59
service . loadEntries ( month ) . subscribe ( ) ;
59
60
60
- const loadEntryRequest = httpMock . expectOne ( `${ service . baseUrl } ?month=${ month } ` ) ;
61
+ const loadEntryRequest = httpMock . expectOne ( `${ service . baseUrl } ?month=${ month } &timezone_offset= ${ timezoneOffset } ` ) ;
61
62
expect ( loadEntryRequest . request . method ) . toBe ( 'GET' ) ;
62
63
63
64
} ) ;
@@ -115,6 +116,20 @@ describe('EntryService', () => {
115
116
expect ( loadEntryRequest . request . params . get ( 'limit' ) ) . toEqual ( '9999' ) ;
116
117
} ) ;
117
118
119
+ it ( 'when getting time entries for report, timezone_offset parameter should be sent' , ( ) => {
120
+ const yesterday = moment ( new Date ( ) ) . subtract ( 1 , 'day' ) ;
121
+ const today = moment ( new Date ( ) ) ;
122
+ const timeRange : TimeEntriesTimeRange = { start_date : yesterday , end_date : today } ;
123
+ const userId = '123' ;
124
+
125
+ service . loadEntriesByTimeRange ( timeRange , userId ) . subscribe ( ) ;
126
+
127
+ const loadEntryRequest = httpMock . expectOne ( req => req . method === 'GET' && req . url === service . baseUrl ) ;
128
+
129
+ const timezoneOffset = new Date ( ) . getTimezoneOffset ( ) . toString ( ) ;
130
+ expect ( loadEntryRequest . request . params . get ( 'timezone_offset' ) ) . toEqual ( timezoneOffset ) ;
131
+ } ) ;
132
+
118
133
it ( 'when restarting entry, a POST is triggered' , ( ) => {
119
134
const entry = 'entryId' ;
120
135
0 commit comments