Merge pull request #8726 from abpframework/fix/testing-error

Angular UI: fixed a testing error
pull/8727/head
Muhammed Altuğ 5 years ago committed by GitHub
commit 8a370b8637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
import { registerLocaleData } from '@angular/common';
import { Injectable, Injector, isDevMode, NgZone, Optional, SkipSelf } from '@angular/core';
import { Injectable, Injector, isDevMode, Optional, SkipSelf } from '@angular/core';
import { from, Observable, Subject } from 'rxjs';
import { filter, map, mapTo, switchMap, tap } from 'rxjs/operators';
import { ABP } from '../models/common';
@ -31,7 +31,6 @@ export class LocalizationService {
constructor(
private sessionState: SessionStateService,
private injector: Injector,
private ngZone: NgZone,
@Optional()
@SkipSelf()
otherInstance: LocalizationService,

@ -8,8 +8,6 @@ import { LocalizationService } from '../services/localization.service';
import { CORE_OPTIONS } from '../tokens/options.token';
import { CONFIG_STATE_DATA } from './config-state.service.spec';
const shouldReuseRoute = () => true;
describe('LocalizationService', () => {
let spectator: SpectatorService<LocalizationService>;
let sessionState: SpyObject<SessionStateService>;
@ -37,8 +35,6 @@ describe('LocalizationService', () => {
spectator = createService();
sessionState = spectator.inject(SessionStateService);
configState = spectator.inject(ConfigStateService);
router = spectator.inject(Router);
router.routeReuseStrategy = { shouldReuseRoute } as any;
service = spectator.service;
configState.setState(CONFIG_STATE_DATA);
@ -72,17 +68,6 @@ describe('LocalizationService', () => {
});
describe('#registerLocale', () => {
it('should return registerLocale and then call setRouteReuse', () => {
router.navigateByUrl.andCallFake(url => {
return new Promise(resolve => resolve({ catch: () => null }));
});
service.registerLocale('tr');
expect(router.navigated).toBe(false);
expect(router.routeReuseStrategy.shouldReuseRoute).not.toEqual(shouldReuseRoute);
});
it('should throw an error message when service have an otherInstance', async () => {
try {
const instance = new LocalizationService(
@ -90,7 +75,6 @@ describe('LocalizationService', () => {
spectator.inject(Injector),
null,
null,
null,
{} as any,
);
} catch (error) {

Loading…
Cancel
Save