@@ -127,7 +127,8 @@ describe('TimeEntriesComponent', () => {
127
127
} ) ) ;
128
128
129
129
it ( 'when create time entries, the time entries should be queried' , ( ) => {
130
- const currentMonth = new Date ( ) . getMonth ( ) + 1 ;
130
+ const currentMonth = new Date ( ) . getMonth ( ) ;
131
+ const year = new Date ( ) . getFullYear ( ) ;
131
132
const entryToSave = {
132
133
entry : {
133
134
project_id : 'project-id' ,
@@ -142,7 +143,7 @@ describe('TimeEntriesComponent', () => {
142
143
143
144
component . saveEntry ( entryToSave ) ;
144
145
expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . CreateEntry ( entryToSave . entry ) ) ;
145
- expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( currentMonth ) ) ;
146
+ expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( currentMonth , year ) ) ;
146
147
} ) ;
147
148
148
149
it ( 'when creating a new entry, then entryId should be null' , ( ) => {
@@ -324,11 +325,12 @@ describe('TimeEntriesComponent', () => {
324
325
} ) ;
325
326
326
327
it ( 'should get the entry List by Month and year' , ( ) => {
327
- const month = 1 ;
328
- const year = 2020 ;
328
+ const month = new Date ( ) . getMonth ( ) ;
329
+ const year = new Date ( ) . getFullYear ( ) ;
330
+
329
331
spyOn ( store , 'dispatch' ) ;
330
- component . dateSelected ( { monthIndex : month , year : 2020 } ) ;
331
- expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( month ) ) ;
332
+ component . dateSelected ( { monthIndex : month , year : year } ) ;
333
+ expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( month + 1 , year ) ) ;
332
334
} ) ;
333
335
334
336
it ( 'doSave when activeTimeEntry === null' , waitForAsync ( ( ) => {
0 commit comments