diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.spec.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.spec.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.spec.ts new file mode 100644 index 000000000..787e5db7c --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.spec.ts @@ -0,0 +1,39 @@ +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; + +import { configureTestBed } from '~/testing/unit-test-helper'; +import { DaemonService } from './daemon.service'; + +describe('DaemonService', () => { + let service: DaemonService; + let httpTesting: HttpTestingController; + + configureTestBed({ + providers: [DaemonService], + imports: [HttpClientTestingModule] + }); + + beforeEach(() => { + service = TestBed.inject(DaemonService); + httpTesting = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpTesting.verify(); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should call action', () => { + const put_data: any = { + action: 'start', + container_image: null + }; + service.action('osd.1', 'start').subscribe(); + const req = httpTesting.expectOne('api/daemon/osd.1'); + expect(req.request.method).toBe('PUT'); + expect(req.request.body).toEqual(put_data); + }); +}); |