@@ -2,11 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22import { provideMockStore , MockStore } from '@ngrx/store/testing' ;
33import { FormsModule , ReactiveFormsModule } from '@angular/forms' ;
44
5- import {
6- MonthPickerComponent ,
7- DetailsFieldsComponent ,
8- EmptyStateComponent ,
9- } from '../../shared/components' ;
5+ import { MonthPickerComponent , DetailsFieldsComponent , EmptyStateComponent } from '../../shared/components' ;
106import { GroupByDatePipe } from '../../shared/pipes' ;
117import { TechnologyState } from '../../shared/store/technology.reducers' ;
128import { allTechnologies } from '../../shared/store/technology.selectors' ;
@@ -16,8 +12,8 @@ import { getProjects } from '../../customer-management/components/projects/compo
1612import { EntryState } from '../../time-clock/store/entry.reducer' ;
1713import { allEntries } from '../../time-clock/store/entry.selectors' ;
1814import * as entryActions from '../../time-clock/store/entry.actions' ;
19- import { TechnologiesComponent } from '../../shared/components/technologies/technologies.component' ;
20- import { TimeEntriesSummaryComponent } from '../../time-clock/components/time-entries-summary/time-entries-summary.component' ;
15+ import { TechnologiesComponent } from '../../shared/components/technologies/technologies.component' ;
16+ import { TimeEntriesSummaryComponent } from '../../time-clock/components/time-entries-summary/time-entries-summary.component' ;
2117
2218describe ( 'TimeEntriesComponent' , ( ) => {
2319 type Merged = TechnologyState & ProjectState & EntryState ;
@@ -70,7 +66,7 @@ describe('TimeEntriesComponent', () => {
7066 MonthPickerComponent ,
7167 TimeEntriesComponent ,
7268 TechnologiesComponent ,
73- TimeEntriesSummaryComponent
69+ TimeEntriesSummaryComponent ,
7470 ] ,
7571 providers : [ provideMockStore ( { initialState : state } ) ] ,
7672 imports : [ FormsModule , ReactiveFormsModule ] ,
@@ -147,7 +143,7 @@ describe('TimeEntriesComponent', () => {
147143 } ;
148144 mockEntriesSelector = store . overrideSelector ( allEntries , [ newEntry ] ) ;
149145 component . ngOnInit ( ) ;
150- expect ( component . dataByMonth . length ) . toEqual ( 0 ) ;
146+ expect ( component . dataByMonth . length ) . toEqual ( 1 ) ;
151147 } ) ) ;
152148
153149 it ( 'should set entry and entryid to null' , ( ) => {
@@ -157,9 +153,9 @@ describe('TimeEntriesComponent', () => {
157153 } ) ;
158154
159155 it ( 'should set entry and entryid to with data' , ( ) => {
160- component . entryList = [ entry ] ;
156+ component . dataByMonth = [ entry ] ;
161157 component . editEntry ( 'entry_1' ) ;
162- expect ( component . entry ) . toBe ( entry ) ;
158+ expect ( component . entry ) . toEqual ( entry ) ;
163159 expect ( component . entryId ) . toBe ( 'entry_1' ) ;
164160 } ) ;
165161
@@ -198,8 +194,8 @@ describe('TimeEntriesComponent', () => {
198194
199195 it ( 'should get the entry List by Month' , ( ) => {
200196 const month = 1 ;
201- component . entryList = [ entry ] ;
197+ spyOn ( store , 'dispatch' ) ;
202198 component . getMonth ( month ) ;
203- expect ( component . dataByMonth . length ) . toEqual ( 1 ) ;
199+ expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( month ) ) ;
204200 } ) ;
205201} ) ;
0 commit comments