Skip to content

Commit

Permalink
fix: Reconciliation API URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Sep 23, 2024
1 parent 5ce243e commit 8f4ee26
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default {
],
coverageThreshold: {
global: {
lines: 91.4,
statements: 91.4,
lines: 91.39,
statements: 91.39,
branches: 95.46,
functions: 92.62,
},
Expand Down
6 changes: 2 additions & 4 deletions packages/network-of-terms-catalog/src/getCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ export async function fromStore(store: RDF.Store): Promise<Catalog> {
bindings
.get('reconciliationUrlTemplate')!
.value.replace(
'{distribution}',
bindings
.get('distribution')!
.value.replace('#', '%23') // Escape # in URL.
'{dataset}',
bindings.get('dataset')!.value.replace('#', '%23') // Escape # in URL.
)
)
),
Expand Down
23 changes: 11 additions & 12 deletions packages/network-of-terms-catalog/test/catalog.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {
Catalog,
Dataset,
Feature,
FeatureType,
IRI,
SparqlDistribution,
} from '@netwerk-digitaal-erfgoed/network-of-terms-query';
import {getCatalog, fromFile, fromStore} from '../src/index.js';
import {fromFile, fromStore, getCatalog} from '../src/index.js';
import {dirname, resolve} from 'path';
import {fileURLToPath} from 'url';

Expand All @@ -30,8 +29,8 @@ describe('Catalog', () => {
catalog.getDatasetByDistributionIri(new IRI('https://nope.com'))
).toBeUndefined();

const cht = catalog.getDatasetByDistributionIri(
new IRI('https://data.cultureelerfgoed.nl/PoolParty/sparql/term/id/cht')
const cht = catalog.getDatasetByIri(
new IRI('https://data.cultureelerfgoed.nl/term/id/cht')
)!;
expect(cht).toBeInstanceOf(Dataset);
expect(cht.name).toEqual('Cultuurhistorische Thesaurus');
Expand All @@ -52,6 +51,12 @@ describe('Catalog', () => {
'Rijksdienst voor het Cultureel Erfgoed'
);
expect(cht.creators[0].alternateName).toEqual('RCE');
expect(cht.distributions[0].features[0].type).toEqual(
FeatureType.RECONCILIATION
);
expect(cht.distributions[0].features[0].url.toString()).toEqual(
`https://termennetwerk-api.netwerkdigitaalerfgoed.nl/reconcile/${cht.iri}`
);
});

it('can retrieve distributions by IRI', () => {
Expand Down Expand Up @@ -84,14 +89,8 @@ describe('Catalog', () => {
const reconciliationApis = catalog.getDistributionsProvidingFeature(
FeatureType.RECONCILIATION
);
expect(reconciliationApis[0].features).toContainEqual(
new Feature(
FeatureType.RECONCILIATION,
new URL(
'https://termennetwerk-api.netwerkdigitaalerfgoed.nl/reconcile/' +
reconciliationApis[0].iri.toString().replace('#', '%23')
)
)
expect(reconciliationApis[0].features[0].type).toEqual(
FeatureType.RECONCILIATION
);
});

Expand Down

0 comments on commit 8f4ee26

Please sign in to comment.