]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-site.service.spec.ts
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / rgw-site.service.spec.ts
CommitLineData
9f95a23c
TL
1import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2import { TestBed } from '@angular/core/testing';
3
4import { configureTestBed } from '../../../testing/unit-test-helper';
5import { RgwSiteService } from './rgw-site.service';
6
7describe('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.get(RgwSiteService);
18 httpTesting = TestBed.get(HttpTestingController);
19 });
20
21 afterEach(() => {
22 httpTesting.verify();
23 });
24
25 it('should be created', () => {
26 expect(service).toBeTruthy();
27 });
28
e306af50
TL
29 it('should contain site endpoint in GET request', () => {
30 service.get().subscribe();
31 const req = httpTesting.expectOne(service['url']);
9f95a23c
TL
32 expect(req.request.method).toBe('GET');
33 });
e306af50
TL
34
35 it('should add query param in GET request', () => {
36 const query = 'placement-targets';
37 service.get(query).subscribe();
38 httpTesting.expectOne(`${service['url']}?query=placement-targets`);
39 });
9f95a23c 40});