Skip to content

Commit

Permalink
Rename store instance types
Browse files Browse the repository at this point in the history
This brings it in line with the recommended approach from NgRx Signals.
  • Loading branch information
jits committed Aug 1, 2024
1 parent 6d0d1de commit d915f74
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/app/login/feature/login-flow.store.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ActivatedRoute, Router } from '@angular/router';
import { MockBuilder, ngMocks } from 'ng-mocks';
import { LoginService } from '../data/login.service';
import { LoginFlowStore, LoginFlowStoreInstanceType } from './login-flow.store';
import { LoginFlowStore } from './login-flow.store';

describe('LoginFlowStore', () => {
beforeEach(() =>
MockBuilder(LoginFlowStore).mock(LoginService).mock(ActivatedRoute).mock(Router),
);

it('should create', () => {
const store = ngMocks.get<LoginFlowStoreInstanceType>(LoginFlowStore);
const store = ngMocks.get<LoginFlowStore>(LoginFlowStore);
expect(store).toBeTruthy();
});
});
2 changes: 1 addition & 1 deletion app/src/app/login/feature/login-flow.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const initialState: LoginFlowState = {

const logger = createLogger('LoginFlowStore');

export type LoginFlowStoreInstanceType = InstanceType<typeof LoginFlowStore>;
export type LoginFlowStore = InstanceType<typeof LoginFlowStore>;

export const LoginFlowStore = signalStore(
withState<LoginFlowState>(initialState),
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/shared/auth/data/auth.store.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MockBuilder, MockInstance, ngMocks } from 'ng-mocks';
import { of } from 'rxjs';
import { AuthService } from './auth.service';
import { AuthStore, AuthStoreInstanceType } from './auth.store';
import { AuthStore } from './auth.store';

describe('AuthStore', () => {
MockInstance.scope();
Expand All @@ -11,7 +11,7 @@ describe('AuthStore', () => {
it('should create', () => {
MockInstance(AuthService, 'user$', of(null));

const store = ngMocks.get<AuthStoreInstanceType>(AuthStore);
const store = ngMocks.get<AuthStore>(AuthStore);
expect(store).toBeTruthy();
});
});
4 changes: 2 additions & 2 deletions app/src/app/shared/auth/data/auth.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const initialState: AuthState = {

const logger = createLogger('AuthStore');

export type AuthStoreInstanceType = InstanceType<typeof AuthStore>;
export type AuthStore = InstanceType<typeof AuthStore>;

export const AuthStore = signalStore(
{ providedIn: 'root' },
Expand Down Expand Up @@ -126,7 +126,7 @@ export const AuthStore = signalStore(
}),
);

function helpersFactory(store: AuthStoreInstanceType) {
function helpersFactory(store: AuthStore) {
const waitUntilConnected$ = toObservable(store.status).pipe(
tap((status) => logger.log('waitUntilConnected$ - status =', status)),
filter((status) => status === 'connected'),
Expand Down

0 comments on commit d915f74

Please sign in to comment.