mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
[ADF-847] upgrade to use application configuration service (#1986)
* migrate core lib to use server-side app config * fix unit tests * update Search tests - update tests - upgrade tests to use TestBed * update UserInfo tests * update Social tests * update tests * update unit tests * cleanup old code * update about page * update demo shell readme * dev and prod configurations
This commit is contained in:
committed by
Eugenio Romano
parent
f5b94e1bb4
commit
d5f64fa9fc
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ReflectiveInjector } from '@angular/core';
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
@@ -23,30 +23,39 @@ import { StorageService } from './storage.service';
|
||||
import { CookieService } from './cookie.service';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { LogService } from './log.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('AlfrescoAuthenticationService', () => {
|
||||
let injector;
|
||||
let apiService: AlfrescoApiService;
|
||||
let authService: AlfrescoAuthenticationService;
|
||||
let settingsService: AlfrescoSettingsService;
|
||||
let storage: StorageService;
|
||||
let cookie: CookieService;
|
||||
|
||||
beforeEach(() => {
|
||||
injector = ReflectiveInjector.resolveAndCreate([
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
StorageService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
LogService
|
||||
]);
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AppConfigModule
|
||||
],
|
||||
providers: [
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
StorageService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
LogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
authService = injector.get(AlfrescoAuthenticationService);
|
||||
settingsService = injector.get(AlfrescoSettingsService);
|
||||
cookie = injector.get(CookieService);
|
||||
storage = injector.get(StorageService);
|
||||
beforeEach(() => {
|
||||
apiService = TestBed.get(AlfrescoApiService);
|
||||
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||
cookie = TestBed.get(CookieService);
|
||||
storage = TestBed.get(StorageService);
|
||||
storage.clear();
|
||||
|
||||
jasmine.Ajax.install();
|
||||
@@ -350,32 +359,6 @@ describe('AlfrescoAuthenticationService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Setting service change should reflect in the api', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
settingsService.setProviders('ALL');
|
||||
});
|
||||
|
||||
it('should host ecm url change be reflected in the api configuration', () => {
|
||||
settingsService.ecmHost = '127.99.99.99';
|
||||
|
||||
expect(authService.alfrescoApi.getInstance().config.hostEcm).toBe('127.99.99.99');
|
||||
});
|
||||
|
||||
it('should host bpm url change be reflected in the api configuration', () => {
|
||||
settingsService.bpmHost = '127.99.99.99';
|
||||
|
||||
expect(authService.alfrescoApi.getInstance().config.hostBpm).toBe('127.99.99.99');
|
||||
});
|
||||
|
||||
it('should host bpm provider change be reflected in the api configuration', () => {
|
||||
settingsService.setProviders('ECM');
|
||||
|
||||
expect(authService.alfrescoApi.getInstance().config.provider).toBe('ECM');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when the setting is both ECM and BPM ', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
|
Reference in New Issue
Block a user