Skip to content

Commit c478310

Browse files
authored
Merge pull request #29 from ESA-APEx/28-update-logic-to-use-conformsto-to-check-if-it-is-an-openeo-or-ogc-api-process-based-service
fix(#28): updated algorithm type calculation based on conformsTo classes
2 parents f42a63c + e10d970 commit c478310

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

src/lib/load-catalogue.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,12 @@ const fetchJson = (url: string) => {
3636

3737

3838
const getAlgorithmType = (algorithm: Algorithm): AlgorithmType => {
39-
const applicationLink = algorithm.links.find(l => l.rel === 'application')
40-
41-
if (!applicationLink) {
42-
return AlgorithmType.NONE
43-
}
44-
45-
switch (applicationLink.type) {
46-
case 'application/cwl+yaml':
47-
return AlgorithmType.OGC_API_PROCESS;
48-
case 'application/vnd.openeo+json;type=process':
49-
return AlgorithmType.OPENEO;
50-
default:
51-
return AlgorithmType.NONE
39+
if (algorithm.conformsTo.includes('https://apex.esa.int/core/openeo-udp')) {
40+
return AlgorithmType.OPENEO;
41+
} else if (algorithm.conformsTo.includes('https://apex.esa.int/core/ogc-api-processes')) {
42+
return AlgorithmType.OGC_API_PROCESS;
43+
} else {
44+
return AlgorithmType.NONE;
5245
}
5346
}
5447

tests/catalog.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test.describe('Catalog Tests', () => {
1010
await expect(page).toHaveTitle('Algorithm Services Catalogue | APEx');
1111
await expect(page.getByRole('heading', { level: 1 })).toContainText('Algorithm Services Catalogue');
1212

13-
const card = page.getByTestId('service-card').getByText('ESA worldcereal global maize detector').locator('..');
13+
const card = page.getByTestId('service-card').getByText('ESA worldcereal global crop type detector').locator('..');
1414
await expect(card).toBeVisible()
1515

1616
await expect(card.getByTestId('service-type')).toHaveText('openEO');

tests/details.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {expect, type Page, test} from '@playwright/test';
22

3+
34
const openService = async (page: Page, name: string) => {
45
await page.getByTestId('service-card').getByText(name).first().click();
56
}
@@ -12,8 +13,8 @@ test.describe('Service Details Test', () => {
1213

1314
test("Should open the details page", async ({page}) => {
1415

15-
await openService(page, 'ESA worldcereal global maize detector');
16-
await page.waitForURL('**/apps/worldcereal_crop_extent');
16+
await openService(page, 'ESA worldcereal global crop type detector');
17+
await page.waitForURL('**/apps/worldcereal_crop_type');
1718
});
1819

1920
test("Should show the correct links for an openEO service", async ({page}) => {

0 commit comments

Comments
 (0)