1 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2 import { TestBed } from '@angular/core/testing';
4 import { configureTestBed, RgwHelper } from '~/testing/unit-test-helper';
5 import { RgwSiteService } from './rgw-site.service';
7 describe('RgwSiteService', () => {
8 let service: RgwSiteService;
9 let httpTesting: HttpTestingController;
12 providers: [RgwSiteService],
13 imports: [HttpClientTestingModule]
17 service = TestBed.inject(RgwSiteService);
18 httpTesting = TestBed.inject(HttpTestingController);
19 RgwHelper.selectDaemon();
26 it('should be created', () => {
27 expect(service).toBeTruthy();
30 it('should contain site endpoint in GET request', () => {
31 service.get().subscribe();
32 const req = httpTesting.expectOne(`${service['url']}?${RgwHelper.DAEMON_QUERY_PARAM}`);
33 expect(req.request.method).toBe('GET');
36 it('should add query param in GET request', () => {
37 const query = 'placement-targets';
38 service.get(query).subscribe();
39 httpTesting.expectOne(
40 `${service['url']}?${RgwHelper.DAEMON_QUERY_PARAM}&query=placement-targets`