Skip to content

Commit 3d1a37b

Browse files
author
Juan Gabriel Guzman
committed
feat: #333 Refreshing data when creating/updting time entries
1 parent 36d0fcf commit 3d1a37b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/app/modules/time-entries/pages/time-entries.component.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,17 @@ describe('TimeEntriesComponent', () => {
249249

250250
expect(component.doSave).toHaveBeenCalledWith(entryToSave);
251251
}));
252+
253+
it('when saving time entries, the time entries should be queried', () => {
254+
const currentMonth = new Date().getMonth() + 1;
255+
const entryToSave = {
256+
project_id: 'project-id'
257+
};
258+
component.activeTimeEntry = null;
259+
spyOn(store, 'dispatch');
260+
261+
component.saveEntry(entryToSave);
262+
263+
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.LoadEntries(currentMonth));
264+
});
252265
});

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class TimeEntriesComponent implements OnInit {
6565
} else {
6666
this.store.dispatch(new entryActions.CreateEntry(entry));
6767
}
68+
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1));
6869
}
6970

7071
removeEntry(entryId: string) {

0 commit comments

Comments
 (0)