it('should call list', fakeAsync(() => {
let result;
- service.list().then((resp) => (result = resp));
+ service.list().subscribe((resp) => (result = resp));
const req = httpTesting.expectOne('api/host');
expect(req.request.method).toBe('GET');
req.flush(['foo', 'bar']);
tick();
expect(result).toEqual(['foo', 'bar']);
}));
+
+ it('should make a GET request on the devices endpoint when requesting devices', () => {
+ const hostname = 'hostname';
+ service.getDevices(hostname).subscribe();
+ const req = httpTesting.expectOne(`api/host/${hostname}/devices`);
+ expect(req.request.method).toBe('GET');
+ });
});