Skip to content

Commit

Permalink
fix(store): provide the same instance of MockStore (#2381)
Browse files Browse the repository at this point in the history
Closes #2362
  • Loading branch information
lacolaco authored Feb 14, 2020
1 parent b42f7da commit 827f336
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/store/testing/spec/mock_store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ describe('Mock Store', () => {
mockStore.resetSelectors();
});

it('should provide the same instance with Store and MockStore', () => {
const fromStore = TestBed.get(Store);
const fromMockStore = TestBed.get(MockStore);
expect(fromStore).toBe(fromMockStore);
});

it('should set the initial state to a mocked one', (done: DoneFn) => {
const fixedState = {
counter1: 17,
Expand Down
2 changes: 1 addition & 1 deletion modules/store/testing/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function provideMockStore<T = any>(
{ provide: MOCK_SELECTORS, useValue: config.selectors },
{ provide: StateObservable, useClass: MockState },
{ provide: ReducerManager, useClass: MockReducerManager },
{ provide: Store, useClass: MockStore },
{ provide: Store, useExisting: MockStore },
];
}

Expand Down

0 comments on commit 827f336

Please sign in to comment.