Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions src/app/core/services/agent.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,38 @@ describe('AgentService', () => {
});
});

describe('listApps', () => {
it('should call list-apps endpoint with correct url', () => {
service.listApps().subscribe();
const req = httpTestingController.expectOne(
API_SERVER_BASE_URL + LIST_APPS_PATH,
);
expect(req.request.method).toEqual(METHOD_GET);
req.flush([]);
});

it('should return list of apps from http get', async () => {
const appsPromise = firstValueFrom(service.listApps());
const req = httpTestingController.expectOne(
API_SERVER_BASE_URL + LIST_APPS_PATH,
);
req.flush(['app1', 'app2']);
const apps = await appsPromise;
expect(apps).toEqual(['app1', 'app2']);
});

it('should return an empty observable if apiServerDomain is not set',
async () => {
service.apiServerDomain = '';
const appsPromise = firstValueFrom(service.listApps());
const req = httpTestingController.expectOne(LIST_APPS_PATH);
req.flush([]);
const apps = await appsPromise;
expect(apps).toEqual([]);
});
});
// BEGIN-EXTERNAL
// describe('listApps', () => {
// it('should call list-apps endpoint with correct url', () => {
// service.listApps().subscribe();
// const req = httpTestingController.expectOne(
// API_SERVER_BASE_URL + LIST_APPS_PATH,
// );
// expect(req.request.method).toEqual(METHOD_GET);
// req.flush([]);
// });

// it('should return list of apps from http get', async () => {
// const appsPromise = firstValueFrom(service.listApps());
// const req = httpTestingController.expectOne(
// API_SERVER_BASE_URL + LIST_APPS_PATH,
// );
// req.flush(['app1', 'app2']);
// const apps = await appsPromise;
// expect(apps).toEqual(['app1', 'app2']);
// });

// it('should return an empty observable if apiServerDomain is not set',
// async () => {
// service.apiServerDomain = '';
// const appsPromise = firstValueFrom(service.listApps());
// const req = httpTestingController.expectOne(LIST_APPS_PATH);
// req.flush([]);
// const apps = await appsPromise;
// expect(apps).toEqual([]);
// });
// });
// END-EXTERNAL

describe('runSse', () => {
it('should set loading state to true when called', () => {
Expand Down