|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import { waitForAsync } from '@angular/core/testing';
|
|
|
|
|
import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest';
|
|
|
|
|
import { Environment } from '../models';
|
|
|
|
|
import { EnvironmentService } from '../services';
|
|
|
|
@ -17,6 +18,7 @@ export const ENVIRONMENT_DATA = ({
|
|
|
|
|
other: {
|
|
|
|
|
url: 'https://localhost:44306',
|
|
|
|
|
},
|
|
|
|
|
yetAnother: {},
|
|
|
|
|
},
|
|
|
|
|
localization: {
|
|
|
|
|
defaultResourceName: 'MyProjectName',
|
|
|
|
@ -39,19 +41,28 @@ describe('ConfigState', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('#getEnvironment', () => {
|
|
|
|
|
it('should return ENVIRONMENT_DATA', () => {
|
|
|
|
|
expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA);
|
|
|
|
|
environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA));
|
|
|
|
|
});
|
|
|
|
|
it(
|
|
|
|
|
'should return ENVIRONMENT_DATA',
|
|
|
|
|
waitForAsync(() => {
|
|
|
|
|
expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA);
|
|
|
|
|
environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA));
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('#getApiUrl', () => {
|
|
|
|
|
it('should return api url', () => {
|
|
|
|
|
expect(environment.getApiUrl()).toEqual(ENVIRONMENT_DATA.apis.default.url);
|
|
|
|
|
environment
|
|
|
|
|
.getApiUrl$('other')
|
|
|
|
|
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url));
|
|
|
|
|
});
|
|
|
|
|
it(
|
|
|
|
|
'should return api url',
|
|
|
|
|
waitForAsync(() => {
|
|
|
|
|
expect(environment.getApiUrl()).toEqual(ENVIRONMENT_DATA.apis.default.url);
|
|
|
|
|
environment
|
|
|
|
|
.getApiUrl$('other')
|
|
|
|
|
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url));
|
|
|
|
|
environment
|
|
|
|
|
.getApiUrl$('yetAnother')
|
|
|
|
|
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.default.url));
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// TODO: create permission.service.spec.ts
|
|
|
|
|