1 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2 import { TestBed } from '@angular/core/testing';
4 import { configureTestBed } from '~/testing/unit-test-helper';
5 import { DaemonService } from './daemon.service';
7 describe('DaemonService', () => {
8 let service: DaemonService;
9 let httpTesting: HttpTestingController;
12 providers: [DaemonService],
13 imports: [HttpClientTestingModule]
17 service = TestBed.inject(DaemonService);
18 httpTesting = TestBed.inject(HttpTestingController);
25 it('should be created', () => {
26 expect(service).toBeTruthy();
29 it('should call action', () => {
30 const put_data: any = {
34 service.action('osd.1', 'start').subscribe();
35 const req = httpTesting.expectOne('api/daemon/osd.1');
36 expect(req.request.method).toBe('PUT');
37 expect(req.request.body).toEqual(put_data);