Skip to content

Commit e839109

Browse files
scastillo-jpGuido Quezada
authored andcommitted
TT-39 fix: resolve tests
1 parent 8cdf916 commit e839109

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/app/modules/shared/components/month-picker/month-picker.component.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { months } from 'moment';
23

34
import { MonthPickerComponent } from './month-picker.component';
45

@@ -23,10 +24,11 @@ describe('MonthPickerComponent', () => {
2324
expect(component).toBeTruthy();
2425
});
2526

26-
it('should emit activeMonth event', () => {
27+
it('should emit monthIndex and year', () => {
2728
const month = 2;
28-
spyOn(component.monthSelected, 'emit');
29-
component.getMonth(month);
30-
expect(component.monthSelected.emit).toHaveBeenCalledWith(month + 1);
29+
const year = 2020;
30+
spyOn(component.dateSelected, 'emit');
31+
expect(component.dateSelected.emit({ monthIndex: month, year: year }));
3132
});
33+
3234
});

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { TimeEntriesComponent } from './time-entries.component';
1818
import { ActionsSubject } from '@ngrx/store';
1919
import { EntryActionTypes } from './../../time-clock/store/entry.actions';
2020
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
21+
import { months } from 'moment';
2122

2223
describe('TimeEntriesComponent', () => {
2324
type Merged = TechnologyState & ProjectState & EntryState;
@@ -322,10 +323,11 @@ describe('TimeEntriesComponent', () => {
322323
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.DeleteEntry('id'));
323324
});
324325

325-
it('should get the entry List by Month', () => {
326+
it('should get the entry List by Month and year', () => {
326327
const month = 1;
328+
const year = 2020;
327329
spyOn(store, 'dispatch');
328-
component.getMonth(month);
330+
component.dateSelected({monthIndex: month, year: 2020});
329331
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.LoadEntries(month));
330332
});
331333

0 commit comments

Comments
 (0)