Skip to content

Commit 1e5baea

Browse files
Update to 6.4.5, add a test to exercise #419 (#43)
1 parent 4585b68 commit 1e5baea

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@angular-redux/form": "^6.3.0",
1717
"@angular-redux/router": "^6.3.0",
18-
"@angular-redux/store": "^6.4.1",
18+
"@angular-redux/store": "6.4.5",
1919
"@angular/common": "^4.1.0",
2020
"@angular/compiler": "^4.1.0",
2121
"@angular/core": "^4.1.0",

src/app/store/module.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { NgRedux, DevToolsExtension } from '@angular-redux/store';
2+
import { NgReduxTestingModule, MockNgRedux } from '@angular-redux/store/testing';
3+
import { TestBed, async, getTestBed } from '@angular/core/testing';
4+
import { StoreModule } from './module';
5+
import { IAppState } from './model';
6+
import { RootEpics } from './epics';
7+
8+
describe('Store Module', () => {
9+
let mockNgRedux: NgRedux<any>;
10+
let devTools: DevToolsExtension;
11+
let mockEpics: RootEpics;
12+
13+
beforeEach(async(() => {
14+
TestBed.configureTestingModule({
15+
imports: [ NgReduxTestingModule ],
16+
}).compileComponents().then(() => {
17+
const testbed = getTestBed();
18+
19+
mockEpics = {
20+
createEpics() { return [] }
21+
} as RootEpics;
22+
23+
devTools = testbed.get(DevToolsExtension);
24+
mockNgRedux = MockNgRedux.getInstance();
25+
});
26+
}));
27+
28+
it('should configure the store when the module is loaded', async(() => {
29+
const configureSpy = spyOn(MockNgRedux.getInstance(), 'configureStore');
30+
const instance = new StoreModule(mockNgRedux, devTools, null, mockEpics);
31+
32+
expect(configureSpy).toHaveBeenCalled();
33+
}));
34+
});

src/app/store/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export class StoreModule {
3838
devTools.isEnabled() ? [ devTools.enhancer() ] : []);
3939

4040
// Enable syncing of Angular router state with our Redux store.
41-
ngReduxRouter.initialize();
41+
if (ngReduxRouter) {
42+
ngReduxRouter.initialize();
43+
}
4244

4345
// Enable syncing of Angular form state with our Redux store.
4446
provideReduxForms(store);

0 commit comments

Comments
 (0)