blob: 0f7d4444be0c5716f568b1d94d2249cd2fd5ce56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import {async, getTestBed, TestBed} from '@angular/core/testing';
import {FormAsyncService} from "./form-async.service";
describe('FormAsyncService', () => {
let injector;
let service: FormAsyncService;
beforeAll(done => (async () => {
TestBed.configureTestingModule({
providers: [FormAsyncService]
});
await TestBed.compileComponents();
injector = getTestBed();
service = injector.get(FormAsyncService);
})().then(done).catch(done.fail));
test('should add cloudOwner according to new tenant value', () => {
const tenants = [{'id': '1', 'name': 'firstTenant', 'isPermitted': true, cloudOwner: 'irma-aic'},
{'id': '2', 'name': 'secondTenant', 'isPermitted': true, cloudOwner: 'irma-aic2'}];
let cloudOwner: string;
cloudOwner = service.onTenantSelect(tenants,'1');
expect(cloudOwner).toEqual('irma-aic');
cloudOwner = service.onTenantSelect(tenants, '2');
expect(cloudOwner).toEqual('irma-aic2');
})
});
|