From 58c20adc10da1a47e7e1ebfb26b88003feafe905 Mon Sep 17 00:00:00 2001 From: Sebastian Frey <sebastian.frey@outlook.com> Date: Mon, 30 Oct 2023 10:48:24 +0100 Subject: [PATCH] test: polish processes e2e tests --- .../processes/test/e2e/processes.e2e.test.ts | 71 +++++++++++++++---- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/packages/processes/test/e2e/processes.e2e.test.ts b/packages/processes/test/e2e/processes.e2e.test.ts index 20f890f..6998b4c 100644 --- a/packages/processes/test/e2e/processes.e2e.test.ts +++ b/packages/processes/test/e2e/processes.e2e.test.ts @@ -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 }); @@ -32,7 +33,7 @@ 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(); @@ -40,6 +41,56 @@ test('e2e: getProcess() should return a process', async () => { }); 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', @@ -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 () => { @@ -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); -}); +*/