Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: #390 reload entries data
  • Loading branch information
enriquezrene committed Jun 16, 2020
commit 2b8de85414ebc2e6bf04809eaf478c6bb61d0fee
13 changes: 13 additions & 0 deletions src/app/modules/time-entries/pages/time-entries.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ describe('TimeEntriesComponent', () => {
expect(component.dataByMonth.length).toEqual(1);
}));

it('when saving time entries, the time entries should be queried', () => {
const currentMonth = new Date().getMonth() + 1;
const entryToSave = {
project_id: 'project-id'
};
component.activeTimeEntry = null;
spyOn(store, 'dispatch');

component.saveEntry(entryToSave);

expect(store.dispatch).toHaveBeenCalledWith(new entryActions.LoadEntries(currentMonth));
});

it('should call dataByMonth with data without end_date in ngOnInit()', async(() => {
const newEntry = {
id: 'entry_1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class TimeEntriesComponent implements OnInit {
} else {
this.doSave(entry);
}
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1));
}

doSave(entry) {
Expand Down