Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
TT-39 fix: resolve tests
  • Loading branch information
scastillo-jp authored and Guido Quezada committed Dec 28, 2020
commit e839109486a9b23c7f023e30b284f116981c1fb1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { months } from 'moment';

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

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

it('should emit activeMonth event', () => {
it('should emit monthIndex and year', () => {
const month = 2;
spyOn(component.monthSelected, 'emit');
component.getMonth(month);
expect(component.monthSelected.emit).toHaveBeenCalledWith(month + 1);
const year = 2020;
spyOn(component.dateSelected, 'emit');
expect(component.dateSelected.emit({ monthIndex: month, year: year }));
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { TimeEntriesComponent } from './time-entries.component';
import { ActionsSubject } from '@ngrx/store';
import { EntryActionTypes } from './../../time-clock/store/entry.actions';
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
import { months } from 'moment';

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

it('should get the entry List by Month', () => {
it('should get the entry List by Month and year', () => {
const month = 1;
const year = 2020;
spyOn(store, 'dispatch');
component.getMonth(month);
component.dateSelected({monthIndex: month, year: 2020});
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.LoadEntries(month));
});

Expand Down