X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fshared%2Fapi%2Fhost.service.spec.ts;h=49b48cd6cfcfc614acafe96edd95b50ef6d0a081;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=e4b6476f2c08b49379d9db292542fba40b680e98;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts index e4b6476f2..49b48cd6c 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts @@ -2,6 +2,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/ import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { configureTestBed } from '~/testing/unit-test-helper'; +import { CdTableFetchDataContext } from '../models/cd-table-fetch-data-context'; import { HostService } from './host.service'; describe('HostService', () => { @@ -27,13 +28,15 @@ describe('HostService', () => { }); it('should call list', fakeAsync(() => { - let result; - service.list('true').subscribe((resp) => (result = resp)); - const req = httpTesting.expectOne('api/host?facts=true'); + let result: any[] = [{}, {}]; + const hostContext = new CdTableFetchDataContext(() => undefined); + service.list(hostContext.toParams(), 'true').subscribe((resp) => (result = resp)); + const req = httpTesting.expectOne('api/host?offset=0&limit=10&search=&sort=%2Bname&facts=true'); expect(req.request.method).toBe('GET'); - req.flush(['foo', 'bar']); + req.flush([{ foo: 1 }, { bar: 2 }]); tick(); - expect(result).toEqual(['foo', 'bar']); + expect(result[0].foo).toEqual(1); + expect(result[1].bar).toEqual(2); })); it('should make a GET request on the devices endpoint when requesting devices', () => {