Skip to content

Commit

Permalink
feat(store): remove getMockStore in favor of createMockStore (#3835)
Browse files Browse the repository at this point in the history
BREAKING CHANGES:

The `getMockStore` function is removed in favor of `createMockStore`

BEFORE:

```ts
import { getMockStore } from '@ngrx/store/testing';
const mockStore = getMockStore();
```

AFTER:

```ts
import { createMockStore } from '@ngrx/store/testing';
const mockStore = createMockStore();
```
  • Loading branch information
timdeschryver authored Apr 10, 2023
1 parent bafd121 commit 8d0ed8e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions modules/store/testing/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,6 @@ function mockStoreFactory<T>(
);
}

/**
* @deprecated This function is deprecated in favor of `createMockStore`.
* If you are looking to get an existing mock store, you probably want to use `TestBed.inject(MockStore)` instead.
*
* For more info see: https://github.com/ngrx/platform/issues/3781
*/
export const getMockStore = createMockStore;

/**
* @description
* Creates mock store with all necessary dependencies outside of the `TestBed`.
Expand All @@ -160,7 +152,9 @@ export const getMockStore = createMockStore;
* });
* ```
*/
export function createMockStore<T>(config: MockStoreConfig<T> = {}): MockStore<T> {
export function createMockStore<T>(
config: MockStoreConfig<T> = {}
): MockStore<T> {
const injector = Injector.create({ providers: provideMockStore(config) });
return injector.get(MockStore);
}
Expand Down

0 comments on commit 8d0ed8e

Please sign in to comment.