@@ -2,11 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
2
import { provideMockStore , MockStore } from '@ngrx/store/testing' ;
3
3
import { FormsModule , ReactiveFormsModule } from '@angular/forms' ;
4
4
5
- import {
6
- MonthPickerComponent ,
7
- DetailsFieldsComponent ,
8
- EmptyStateComponent ,
9
- } from '../../shared/components' ;
5
+ import { MonthPickerComponent , DetailsFieldsComponent , EmptyStateComponent } from '../../shared/components' ;
10
6
import { GroupByDatePipe } from '../../shared/pipes' ;
11
7
import { TechnologyState } from '../../shared/store/technology.reducers' ;
12
8
import { allTechnologies } from '../../shared/store/technology.selectors' ;
@@ -16,8 +12,8 @@ import { getProjects } from '../../customer-management/components/projects/compo
16
12
import { EntryState } from '../../time-clock/store/entry.reducer' ;
17
13
import { allEntries } from '../../time-clock/store/entry.selectors' ;
18
14
import * 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' ;
21
17
22
18
describe ( 'TimeEntriesComponent' , ( ) => {
23
19
type Merged = TechnologyState & ProjectState & EntryState ;
@@ -70,7 +66,7 @@ describe('TimeEntriesComponent', () => {
70
66
MonthPickerComponent ,
71
67
TimeEntriesComponent ,
72
68
TechnologiesComponent ,
73
- TimeEntriesSummaryComponent
69
+ TimeEntriesSummaryComponent ,
74
70
] ,
75
71
providers : [ provideMockStore ( { initialState : state } ) ] ,
76
72
imports : [ FormsModule , ReactiveFormsModule ] ,
@@ -147,7 +143,7 @@ describe('TimeEntriesComponent', () => {
147
143
} ;
148
144
mockEntriesSelector = store . overrideSelector ( allEntries , [ newEntry ] ) ;
149
145
component . ngOnInit ( ) ;
150
- expect ( component . dataByMonth . length ) . toEqual ( 0 ) ;
146
+ expect ( component . dataByMonth . length ) . toEqual ( 1 ) ;
151
147
} ) ) ;
152
148
153
149
it ( 'should set entry and entryid to null' , ( ) => {
@@ -157,9 +153,9 @@ describe('TimeEntriesComponent', () => {
157
153
} ) ;
158
154
159
155
it ( 'should set entry and entryid to with data' , ( ) => {
160
- component . entryList = [ entry ] ;
156
+ component . dataByMonth = [ entry ] ;
161
157
component . editEntry ( 'entry_1' ) ;
162
- expect ( component . entry ) . toBe ( entry ) ;
158
+ expect ( component . entry ) . toEqual ( entry ) ;
163
159
expect ( component . entryId ) . toBe ( 'entry_1' ) ;
164
160
} ) ;
165
161
@@ -198,8 +194,8 @@ describe('TimeEntriesComponent', () => {
198
194
199
195
it ( 'should get the entry List by Month' , ( ) => {
200
196
const month = 1 ;
201
- component . entryList = [ entry ] ;
197
+ spyOn ( store , 'dispatch' ) ;
202
198
component . getMonth ( month ) ;
203
- expect ( component . dataByMonth . length ) . toEqual ( 1 ) ;
199
+ expect ( store . dispatch ) . toHaveBeenCalledWith ( new entryActions . LoadEntries ( month ) ) ;
204
200
} ) ;
205
201
} ) ;
0 commit comments