fix testing errors

pull/9876/head
mehmet-erim 4 years ago
parent a8a2ec47d8
commit 7e636a4937

@ -54,7 +54,6 @@ describe('InitialUtils', () => {
const environmentService = spectator.inject(EnvironmentService);
const configStateService = spectator.inject(ConfigStateService);
const sessionStateService = spectator.inject(SessionStateService);
const applicationConfigurationService = spectator.inject(AbpApplicationConfigurationService);
const parseTenantFromUrlSpy = jest.spyOn(multiTenancyUtils, 'parseTenantFromUrl');
const getRemoteEnvSpy = jest.spyOn(environmentUtils, 'getRemoteEnv');
parseTenantFromUrlSpy.mockReturnValue(Promise.resolve());
@ -64,11 +63,9 @@ describe('InitialUtils', () => {
currentTenant: { id: 'test', name: 'testing' },
} as ApplicationConfigurationDto;
const getConfigurationSpy = jest.spyOn(applicationConfigurationService, 'get');
getConfigurationSpy.mockReturnValue(of(appConfigRes));
const environmentSetStateSpy = jest.spyOn(environmentService, 'setState');
const configSetStateSpy = jest.spyOn(configStateService, 'setState');
const configRefreshAppStateSpy = jest.spyOn(configStateService, 'refreshAppState');
configRefreshAppStateSpy.mockReturnValue(of(appConfigRes));
const sessionSetTenantSpy = jest.spyOn(sessionStateService, 'setTenant');
const configStateGetOneSpy = jest.spyOn(configStateService, 'getOne');
@ -81,9 +78,8 @@ describe('InitialUtils', () => {
await getInitialData(mockInjector)();
expect(typeof getInitialData(mockInjector)).toBe('function');
expect(configRefreshAppStateSpy).toHaveBeenCalled();
expect(environmentSetStateSpy).toHaveBeenCalledWith(environment);
expect(getConfigurationSpy).toHaveBeenCalled();
expect(configSetStateSpy).toHaveBeenCalledWith(appConfigRes);
expect(sessionSetTenantSpy).toHaveBeenCalledWith(appConfigRes.currentTenant);
});
});

@ -74,7 +74,6 @@ describe('LocalizationService', () => {
spectator.inject(Injector),
null,
null,
{} as any,
);
} catch (error) {
expect((error as Error).message).toBe('LocalizationService should have only one instance.');

@ -112,5 +112,5 @@ function createMockLocalizationService() {
const configState = new ConfigStateService(null);
configState.setState({ localization: mockL10n } as any);
return new LocalizationService(mockSessionState, null, null, configState, null);
return new LocalizationService(mockSessionState, null, null, configState);
}

Loading…
Cancel
Save