@@ -181,4 +181,49 @@ describe('ngRx Integration spec', () => {
181181 expect ( currentlyVisibleTodos . length ) . toBe ( 0 ) ;
182182 } ) ;
183183 } ) ;
184+
185+ describe ( 'feature state' , ( ) => {
186+ const initialState = {
187+ todos : [
188+ {
189+ id : 1 ,
190+ text : 'do things' ,
191+ completed : false ,
192+ } ,
193+ ] ,
194+ visibilityFilter : VisibilityFilters . SHOW_ALL ,
195+ } ;
196+
197+ const reducers : ActionReducerMap < TodoAppSchema , any > = {
198+ todos : todos ,
199+ visibilityFilter : visibilityFilter ,
200+ } ;
201+
202+ const featureInitialState = [ { id : 1 , completed : false , text : 'Item' } ] ;
203+
204+ it ( 'should initialize properly' , ( ) => {
205+ TestBed . configureTestingModule ( {
206+ imports : [
207+ StoreModule . forRoot ( reducers , { initialState } ) ,
208+ StoreModule . forFeature ( 'items' , todos , {
209+ initialState : featureInitialState ,
210+ } ) ,
211+ ] ,
212+ } ) ;
213+
214+ const store : Store < any > = TestBed . get ( Store ) ;
215+
216+ let expected = [
217+ {
218+ todos : initialState . todos ,
219+ visibilityFilter : initialState . visibilityFilter ,
220+ items : featureInitialState ,
221+ } ,
222+ ] ;
223+
224+ store . select ( state => state ) . subscribe ( state => {
225+ expect ( state ) . toEqual ( expected . shift ( ) ) ;
226+ } ) ;
227+ } ) ;
228+ } ) ;
184229} ) ;
0 commit comments