Skip to content

Commit

Permalink
test: polish processes e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianfrey committed Oct 30, 2023
1 parent 41067b9 commit 58c20ad
Showing 1 changed file with 57 additions and 14 deletions.
71 changes: 57 additions & 14 deletions packages/processes/test/e2e/processes.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'isomorphic-fetch';
import {
/* IProcess, */
IProcessSummary,
ProcessesService,
} from '../../src/processes';

require('isomorphic-fetch');

const TEST_SITE = 'http://tb17.geolabs.fr:8119/ogc-api/';
const TEST_SITE = 'https://demo.pygeoapi.io/stable/';
// const TEST_SITE = 'http://localhost:5000';
// const TEST_SITE = 'http://tb17.geolabs.fr:8119/ogc-api/';

test('e2e: getConformance() should return a conformance list', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
Expand All @@ -32,14 +33,64 @@ test('e2e: getProcesses() should return a processes list', async () => {

test('e2e: getProcess() should return a process', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const process = await service.getProcess('SAGA.garden_fractals.1');
const process = await service.getProcess('hello-world');

expect(process.id).toBeTruthy();
expect(process.version).toBeTruthy();
expect(process.title).toBeTruthy();
});

test('e2e: executeJob() should execute job synchronously', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const result = await service.executeProcess('hello-world', {
mode: 'sync',
inputs: {
name: '@ogcapi-js'
},
outputs: {
echo: {
transmissionMode: 'value',
},
},
response: 'document',
});

expect(result).toBeTruthy();
// TODO add more assertions when https://github.com/geopython/pygeoapi/discussions/1383 is resolved
});

// TODO: check again when https://github.com/geopython/pygeoapi/discussions/1383#discussioncomment-7421781 is resolved
/* test('e2e: executeJob() should execute job asynchronously', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const result = await service.executeProcess('hello-world', {
mode: 'async',
inputs: {
name: '@ogcapi-js'
},
outputs: {
echo: {
transmissionMode: 'value',
},
},
response: 'document',
});
console.info({ result });
expect(result).toBeTruthy();
}); */


test('e2e: getJobs() should return a jobs list', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const result = await service.getJobs();

expect(Array.isArray(result.jobs)).toBe(true);
});

/*
// TODO: check again when https://github.com/ZOO-Project/ZOO-Project/issues/72 is resolved
/* test('e2e: executeJob() should execute job synchronously', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const result = await service.executeProcess('SAGA.garden_fractals.1', {
mode: 'sync',
Expand All @@ -62,7 +113,7 @@ test('e2e: executeJob() should execute job synchronously', async () => {
expect(result.RESULT).toBeTruthy();
expect((result.RESULT as any).value.type).toBe('FeatureCollection');
});

*/

// TODO: check again when xxx is resolved https://github.com/ZOO-Project/ZOO-Project/issues/72
/* test('e2e: executeJob() should execute job asynchronously', async () => {
Expand All @@ -87,13 +138,5 @@ test('e2e: executeJob() should execute job synchronously', async () => {
expect(result.jobID).toBeTruthy();
});
*/


test('e2e: getJobs() should return a jobs list', async () => {
const service = new ProcessesService({ baseUrl: TEST_SITE });
const result = await service.getJobs();

expect(Array.isArray(result.jobs)).toBe(true);
});
*/

0 comments on commit 58c20ad

Please sign in to comment.