import { NextRunningNo } from './remix.actions' ; import { NgxsModule , Store } from '@ngxs/store' ; import { RemixState , getRemixInitialState } from './remix.state' ; import { TestBed , async } from '@angular/core/testing' ; describe ( 'Remix Reducer' , ( ) => { let store ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { imports : [ NgxsModule . forRoot ( [ RemixState ] ) ] , } ) . compileComponents ( ) ; store = TestBed . get ( Store ) ; } ) ) ; describe ( 'NEXT_RUNNING_NO' , ( ) => { it ( 'should increase runnning no' , ( ) => { const expectedState = { ... getRemixInitialState ( ) , runningNo : 5 } ; store . dispatch ( [ new NextRunningNo ( ) , new NextRunningNo ( ) , new NextRunningNo ( ) , ] ) ; const action = new NextRunningNo ( ) ; store . dispatch ( action ) ; store . selectOnce ( ( state ) => state . remix ) . subscribe ( actual => { expect ( actual ) . toEqual ( expectedState ) ; } ) ; } ) ; } ) ; } ) ;