Skip to content

Commit

Permalink
style: activate eslint rule use-consistant-global-store-name
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Aug 10, 2022
1 parent 9d3f881 commit f8c98d7
Show file tree
Hide file tree
Showing 31 changed files with 260 additions and 257 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@ngrx/prefer-concat-latest-from": "off",
"@ngrx/prefix-selectors-with-select": "off",
"@ngrx/select-style": ["warn", "operator"],
"@ngrx/use-consistent-global-store-name": "off",
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/ban-types": [
"error",
Expand Down Expand Up @@ -828,7 +827,11 @@
"methods": false,
"parameters": false,
"properties": false,
"variables": true
"variables": true,
"types": {
"^EventEmitter$": false,
"^Store": false
}
}
],
"rxjs/no-create": "error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function adaptRoutes(rts: Route[], cmp: Type<unknown>): Route[] {
describe('Organization Management Breadcrumb Service', () => {
let organizationManagementBreadcrumbService: OrganizationManagementBreadcrumbService;
let router: Router;
let store$: Store;
let store: Store;

beforeEach(() => {
@Component({ template: 'dummy' })
Expand All @@ -51,7 +51,7 @@ describe('Organization Management Breadcrumb Service', () => {

organizationManagementBreadcrumbService = TestBed.inject(OrganizationManagementBreadcrumbService);
router = TestBed.inject(Router);
store$ = TestBed.inject(Store);
store = TestBed.inject(Store);

router.initialNavigation();
});
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for user detail page', done => {
store$.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
store.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
router.navigateByUrl('/users/1');

organizationManagementBreadcrumbService.breadcrumb$('/my-account').subscribe(breadcrumbData => {
Expand All @@ -129,7 +129,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for user detail edit page', done => {
store$.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
store.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
router.navigateByUrl('/users/1/profile');

organizationManagementBreadcrumbService.breadcrumb$('/my-account').subscribe(breadcrumbData => {
Expand All @@ -153,7 +153,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for user role edit page', done => {
store$.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
store.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
router.navigateByUrl('/users/1/roles');

organizationManagementBreadcrumbService.breadcrumb$('/my-account').subscribe(breadcrumbData => {
Expand All @@ -177,7 +177,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for user budget edit page', done => {
store$.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
store.dispatch(loadUserSuccess({ user: { login: '1', firstName: 'John', lastName: 'Doe' } as B2bUser }));
router.navigateByUrl('/users/1/budget');

organizationManagementBreadcrumbService.breadcrumb$('/my-account').subscribe(breadcrumbData => {
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for cost center detail page', done => {
store$.dispatch(
store.dispatch(
loadCostCenterSuccess({ costCenter: { id: '1', costCenterId: '100400', name: 'Marketing' } as CostCenter })
);
router.navigateByUrl('/cost-centers/1');
Expand All @@ -259,7 +259,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for cost center edit page', done => {
store$.dispatch(
store.dispatch(
loadCostCenterSuccess({ costCenter: { id: '1', costCenterId: '100400', name: 'Marketing' } as CostCenter })
);
router.navigateByUrl('/cost-centers/1/edit');
Expand All @@ -285,7 +285,7 @@ describe('Organization Management Breadcrumb Service', () => {
});

it('should set breadcrumb for cost center buyers page', done => {
store$.dispatch(
store.dispatch(
loadCostCenterSuccess({ costCenter: { id: '1', costCenterId: '100400', name: 'Marketing' } as CostCenter })
);
router.navigateByUrl('/cost-centers/1/buyers');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Users Effects', () => {
let usersService: UsersService;
let router: Router;
let location: Location;
let store$: Store;
let store: Store;

beforeEach(() => {
usersService = mock(UsersService);
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('Users Effects', () => {
effects = TestBed.inject(UsersEffects);
router = TestBed.inject(Router);
location = TestBed.inject(Location);
store$ = TestBed.inject(Store);
store = TestBed.inject(Store);
});

describe('loadUsers$', () => {
Expand Down Expand Up @@ -307,7 +307,7 @@ describe('Users Effects', () => {

describe('successMessageAfterUpdate$', () => {
beforeEach(() => {
store$.dispatch(loadUsersSuccess({ users }));
store.dispatch(loadUsersSuccess({ users }));
});

describe('on user edit', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/core/guards/auth.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AuthGuard } from './auth.guard';
describe('Auth Guard', () => {
describe('canActivate()', () => {
let authGuard: AuthGuard;
let store$: Store;
let store: Store;

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand All @@ -26,11 +26,11 @@ describe('Auth Guard', () => {

beforeEach(() => {
authGuard = TestBed.inject(AuthGuard);
store$ = TestBed.inject(Store);
store = TestBed.inject(Store);
});

it('should return true when user is authorized', done => {
store$.dispatch(loginUserSuccess({ customer: {} as Customer }));
store.dispatch(loginUserSuccess({ customer: {} as Customer }));

authGuard
.canActivate({} as ActivatedRouteSnapshot, { url: 'home' } as RouterStateSnapshot)
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/guards/hybrid-redirect.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { HYBRID_MAPPING_TABLE } from '../../../hybrid/default-url-mapping-table'

@Injectable({ providedIn: 'root' })
export class HybridRedirectGuard implements CanActivate, CanActivateChild {
constructor(private store$: Store) {}
constructor(private store: Store) {}

private checkRedirect(url: string): boolean | Observable<boolean> {
return this.store$.pipe(
return this.store.pipe(
select(getICMWebURL),
map(icmWebUrl => {
for (const entry of HYBRID_MAPPING_TABLE) {
Expand Down
10 changes: 5 additions & 5 deletions src/app/core/routing/category/category.route.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,22 @@ describe('Category Route', () => {

describe('Category Route', () => {
let router: Router;
let store$: Store;
let store: Store;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreStoreModule.forTesting(['router']), RouterTestingModule.withRoutes([{ path: '**', children: [] }])],
});

router = TestBed.inject(Router);
store$ = TestBed.inject(Store);
store = TestBed.inject(Store);
});

describe('ofCategoryRoute', () => {
it('should detect category route when categoryUniqueId is a param', done => {
router.navigateByUrl('/category;categoryUniqueId=ABC');

store$.pipe(ofCategoryUrl(), select(selectRouter)).subscribe(data => {
store.pipe(ofCategoryUrl(), select(selectRouter)).subscribe(data => {
expect(data.state.params).toMatchInlineSnapshot(`
Object {
"categoryUniqueId": "ABC",
Expand All @@ -192,15 +192,15 @@ describe('Category Route', () => {
it('should not detect category route when sku and categoryUniqueId are params', fakeAsync(() => {
router.navigateByUrl('/category;sku=123;categoryUniqueId=ABC');

store$.pipe(ofCategoryUrl()).subscribe({ next: fail, error: fail });
store.pipe(ofCategoryUrl()).subscribe({ next: fail, error: fail });

tick(2000);
}));

it('should not detect category route when categoryUniqueId is missing', fakeAsync(() => {
router.navigateByUrl('/other');

store$.pipe(ofCategoryUrl()).subscribe({ next: fail, error: fail });
store.pipe(ofCategoryUrl()).subscribe({ next: fail, error: fail });

tick(2000);
}));
Expand Down
10 changes: 5 additions & 5 deletions src/app/core/routing/product/product.route.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,22 @@ describe('Product Route', () => {

describe('Product Route', () => {
let router: Router;
let store$: Store;
let store: Store;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreStoreModule.forTesting(['router']), RouterTestingModule.withRoutes([{ path: '**', children: [] }])],
});

router = TestBed.inject(Router);
store$ = TestBed.inject(Store);
store = TestBed.inject(Store);
});

describe('ofProductRoute', () => {
it('should detect product route when sku is a param', done => {
router.navigateByUrl('/product;sku=123');

store$.pipe(ofProductUrl(), select(selectRouter)).subscribe(data => {
store.pipe(ofProductUrl(), select(selectRouter)).subscribe(data => {
expect(data.state.params).toMatchInlineSnapshot(`
Object {
"sku": "123",
Expand All @@ -340,7 +340,7 @@ describe('Product Route', () => {
it('should detect product route when sku and categoryUniqueId are params', done => {
router.navigateByUrl('/product;sku=123;categoryUniqueId=ABC');

store$.pipe(ofProductUrl(), select(selectRouter)).subscribe(data => {
store.pipe(ofProductUrl(), select(selectRouter)).subscribe(data => {
expect(data.state.params).toMatchInlineSnapshot(`
Object {
"categoryUniqueId": "ABC",
Expand All @@ -354,7 +354,7 @@ describe('Product Route', () => {
it('should not detect product route when sku is missing', fakeAsync(() => {
router.navigateByUrl('/other');

store$.pipe(ofProductUrl()).subscribe({ next: fail, error: fail });
store.pipe(ofProductUrl()).subscribe({ next: fail, error: fail });

tick(2000);
}));
Expand Down
Loading

0 comments on commit f8c98d7

Please sign in to comment.