Skip to content

Commit

Permalink
Merge pull request #9876 from abpframework/fix/testing-errors
Browse files Browse the repository at this point in the history
Angular UI: Fixed the testing errors
  • Loading branch information
bnymncoskuner committed Aug 23, 2021
2 parents a8a2ec4 + 7e636a4 commit 8961827
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
10 changes: 3 additions & 7 deletions npm/ng-packs/packages/core/src/lib/tests/initial-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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');
Expand All @@ -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);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 8961827

Please sign in to comment.