1
- import { Store , createReducer , Action , ofAction , Select , NgrxSelect } from './index' ;
2
- import { Action as NgRxAction , Store as NgRxStore , createFeatureSelector , createSelector } from '@ngrx/store' ;
1
+ import { Store , createReducer , Action , ofAction , Select , NgrxSelect } from '.. /index' ;
2
+ import { Action as NgRxAction , createFeatureSelector , createSelector , Store as NgRxStore } from '@ngrx/store' ;
3
3
import { Observable } from 'rxjs/Observable' ;
4
4
import { of } from 'rxjs/observable/of' ;
5
5
@@ -26,9 +26,9 @@ describe('actions', () => {
26
26
}
27
27
}
28
28
29
- const reducer = createReducer < FooState > ( Bar ) ;
29
+ const reducer = createReducer < FooState | undefined > ( Bar ) ;
30
30
const res = reducer ( undefined , new MyAction ( ) ) ;
31
- expect ( res . foo ) . toBe ( true ) ;
31
+ expect ( res && res . foo ) . toBe ( true ) ;
32
32
} ) ;
33
33
34
34
it ( 'adds defaults' , ( ) => {
@@ -146,7 +146,7 @@ describe('actions', () => {
146
146
action2 = new MyAction2 ( ) ,
147
147
action3 = new MyAction3 ( 'a' , 0 ) ;
148
148
const actions = of < NgRxAction > ( action , action2 , action3 ) ;
149
- let tappedActions : NgRxAction [ ] = [ ] ;
149
+ const tappedActions : NgRxAction [ ] = [ ] ;
150
150
actions . pipe ( ofAction < MyAction | MyAction2 > ( MyAction , MyAction2 ) ) . subscribe ( a => {
151
151
tappedActions . push ( a ) ;
152
152
} ) ;
@@ -157,7 +157,7 @@ describe('actions', () => {
157
157
} ) ;
158
158
159
159
it ( 'selects sub state' , ( ) => {
160
- const state : {
160
+ const featureState : {
161
161
myFeature : FooState ;
162
162
} = {
163
163
myFeature : {
@@ -183,7 +183,7 @@ describe('actions', () => {
183
183
@Select ( msBar ) bar$ : Observable < any > ; // using MemoizedSelector
184
184
}
185
185
186
- const store = new NgRxStore ( of ( state ) , undefined , undefined ) ;
186
+ const store = new NgRxStore ( of ( featureState ) , undefined , undefined ) ;
187
187
188
188
try {
189
189
NgrxSelect . store = store ;
@@ -195,11 +195,11 @@ describe('actions', () => {
195
195
} ) ;
196
196
197
197
mss . myFeature . subscribe ( n => {
198
- expect ( n ) . toBe ( state . myFeature ) ;
198
+ expect ( n ) . toBe ( featureState . myFeature ) ;
199
199
} ) ;
200
200
201
201
mss . bar$ . subscribe ( n => {
202
- expect ( n ) . toBe ( state . myFeature . bar ) ;
202
+ expect ( n ) . toBe ( featureState . myFeature . bar ) ;
203
203
} ) ;
204
204
} finally {
205
205
NgrxSelect . store = undefined ;
0 commit comments