Skip to content

Commit 827f336

Browse files
authored
fix(store): provide the same instance of MockStore (#2381)
Closes #2362
1 parent b42f7da commit 827f336

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

modules/store/testing/spec/mock_store.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ describe('Mock Store', () => {
6363
mockStore.resetSelectors();
6464
});
6565

66+
it('should provide the same instance with Store and MockStore', () => {
67+
const fromStore = TestBed.get(Store);
68+
const fromMockStore = TestBed.get(MockStore);
69+
expect(fromStore).toBe(fromMockStore);
70+
});
71+
6672
it('should set the initial state to a mocked one', (done: DoneFn) => {
6773
const fixedState = {
6874
counter1: 17,

modules/store/testing/src/testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function provideMockStore<T = any>(
2828
{ provide: MOCK_SELECTORS, useValue: config.selectors },
2929
{ provide: StateObservable, useClass: MockState },
3030
{ provide: ReducerManager, useClass: MockReducerManager },
31-
{ provide: Store, useClass: MockStore },
31+
{ provide: Store, useExisting: MockStore },
3232
];
3333
}
3434

0 commit comments

Comments
 (0)