]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-site.service.spec.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / rgw-site.service.spec.ts
1 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2 import { TestBed } from '@angular/core/testing';
3
4 import { configureTestBed, RgwHelper } from '~/testing/unit-test-helper';
5 import { RgwSiteService } from './rgw-site.service';
6
7 describe('RgwSiteService', () => {
8 let service: RgwSiteService;
9 let httpTesting: HttpTestingController;
10
11 configureTestBed({
12 providers: [RgwSiteService],
13 imports: [HttpClientTestingModule]
14 });
15
16 beforeEach(() => {
17 service = TestBed.inject(RgwSiteService);
18 httpTesting = TestBed.inject(HttpTestingController);
19 RgwHelper.selectDaemon();
20 });
21
22 afterEach(() => {
23 httpTesting.verify();
24 });
25
26 it('should be created', () => {
27 expect(service).toBeTruthy();
28 });
29
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');
34 });
35
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`
41 );
42 });
43 });