1 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2 import { TestBed } from '@angular/core/testing';
4 import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
5 import { OrchestratorService } from './orchestrator.service';
7 describe('OrchestratorService', () => {
8 let service: OrchestratorService;
9 let httpTesting: HttpTestingController;
10 const apiPath = 'api/orchestrator';
13 providers: [OrchestratorService, i18nProviders],
14 imports: [HttpClientTestingModule]
18 service = TestBed.get(OrchestratorService);
19 httpTesting = TestBed.get(HttpTestingController);
26 it('should be created', () => {
27 expect(service).toBeTruthy();
30 it('should call status', () => {
31 service.status().subscribe();
32 const req = httpTesting.expectOne(`${apiPath}/status`);
33 expect(req.request.method).toBe('GET');
36 it('should call inventoryList', () => {
37 service.inventoryList().subscribe();
38 const req = httpTesting.expectOne(`${apiPath}/inventory`);
39 expect(req.request.method).toBe('GET');
42 it('should call inventoryList with a host', () => {
44 service.inventoryList(host).subscribe();
45 const req = httpTesting.expectOne(`${apiPath}/inventory?hostname=${host}`);
46 expect(req.request.method).toBe('GET');