|
|
|
@ -7,6 +7,7 @@ import { ABP } from '../models'; |
|
|
|
import { Config } from '../models/config'; |
|
|
|
import { ApplicationConfigurationService, ConfigStateService } from '../services'; |
|
|
|
import { ConfigState } from '../states'; |
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
|
|
|
export const CONFIG_STATE_DATA = { |
|
|
|
environment: { |
|
|
|
@ -136,19 +137,17 @@ describe('ConfigState', () => { |
|
|
|
let store: SpyObject<Store>; |
|
|
|
let service: ConfigStateService; |
|
|
|
let state: ConfigState; |
|
|
|
let appConfigService: SpyObject<ApplicationConfigurationService>; |
|
|
|
|
|
|
|
const createService = createServiceFactory({ |
|
|
|
service: ConfigStateService, |
|
|
|
mocks: [ApplicationConfigurationService, Store], |
|
|
|
mocks: [ApplicationConfigurationService, Store, HttpClient], |
|
|
|
}); |
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
spectator = createService(); |
|
|
|
store = spectator.get(Store); |
|
|
|
service = spectator.service; |
|
|
|
appConfigService = spectator.get(ApplicationConfigurationService); |
|
|
|
state = new ConfigState(spectator.get(ApplicationConfigurationService), store); |
|
|
|
state = new ConfigState(spectator.get(HttpClient), store); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('#getAll', () => { |
|
|
|
@ -283,7 +282,7 @@ describe('ConfigState', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
describe('#GetAppConfiguration', () => { |
|
|
|
it('should call the getConfiguration of ApplicationConfigurationService and patch the state', done => { |
|
|
|
it('should call the app-configuration API and patch the state', done => { |
|
|
|
let patchStateArg; |
|
|
|
let dispatchArg; |
|
|
|
|
|
|
|
@ -299,7 +298,8 @@ describe('ConfigState', () => { |
|
|
|
dispatchArg = a; |
|
|
|
return of(a); |
|
|
|
}); |
|
|
|
appConfigService.getConfiguration.andReturn(res$); |
|
|
|
const httpClient = spectator.get(HttpClient); |
|
|
|
httpClient.get.andReturn(res$); |
|
|
|
|
|
|
|
state.addData({ patchState, dispatch } as any).subscribe(); |
|
|
|
|
|
|
|
|