Skip to content

Commit

Permalink
feat(sparql-in-memory): fix package integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerfaulkner committed Nov 2, 2023
1 parent db9dc2c commit 10c2e9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
9 changes: 5 additions & 4 deletions test/deploy/src/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function frameAndCombineSchemas(
filePaths: string[],
env: Record<string, string> = {},
): Promise<Entity[]> {
const schemas = await Promise.all(
const nestedSchemas = await Promise.all(
filePaths.map(async(filePath: string): Promise<jsonld.NodeObject[]> => {
let schema = await fs.readFile(filePath, { encoding: 'utf8' });
Object.keys(env).forEach((envVar: string): void => {
Expand All @@ -15,7 +15,8 @@ export async function frameAndCombineSchemas(
return await jsonld.expand(JSON.parse(schema));
}),
);
const expandedSchema = schemas.flat();
const framedSchema = await jsonld.frame(expandedSchema, {});
return framedSchema['@graph'] as Entity[];
const schemas = nestedSchemas.flat();
return await Promise.all(
schemas.map((schema): Promise<Entity> => jsonld.compact(schema, {}) as Promise<Entity>),
);
}
19 changes: 11 additions & 8 deletions test/deploy/src/assets/get-ticketmaster-events.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
"skos": "http://www.w3.org/2004/02/skos/core#",
"dcterms": "http://purl.org/dc/elements/1.1/",
"description": "dcterms:description",
"https://standardknowledge.com/ontologies/core/integration": { "@type": "@id" },
"https://standardknowledge.com/ontologies/core/account": { "@type": "@id" },
"https://standardknowledge.com/ontologies/core/openApiDescription": { "@type": "@json" },
"skl:openApiDescription": { "@type": "@json" },
"skl": "https://standardknowledge.com/ontologies/core/",
"https://standardknowledge.com/ontologies/core/parametersContext": { "@type": "@json" },
"https://standardknowledge.com/ontologies/core/returnValueFrame": { "@type": "@json" },
"parameterMapping": {
"@id": "skl:parameterMapping",
Expand All @@ -31,6 +29,10 @@
"@id": "skl:parameterMappingFrame",
"@type": "@json"
},
"parametersContext": {
"@id": "skl:parametersContext",
"@type": "@json"
},
"returnValueMapping": {
"@id": "skl:returnValueMapping",
"@type": "@id"
Expand All @@ -40,6 +42,7 @@
"@type": "@id"
},
"integration": { "@id": "skl:integration", "@type": "@id" },
"account": { "@id": "skl:account", "@type": "@id" },
"verb": { "@id": "skl:verb", "@type": "@id" },
"rml:referenceFormulation": { "@type": "@id" },
"rr:parentTriplesMap": { "@type": "@id" },
Expand All @@ -61,14 +64,14 @@
{
"@id": "https://example.com/data/TicketmasterAccount1",
"@type": "https://standardknowledge.com/ontologies/core/Account",
"https://standardknowledge.com/ontologies/core/integration": "https://example.com/integrations/Ticketmaster",
"integration": "https://example.com/integrations/Ticketmaster",
"rdfs:label": "Ticketmaster Account"
},
{
"@id": "https://example.com/data/TicketmasterAccount1SecurityCredentials",
"@type": "https://standardknowledge.com/ontologies/core/SecurityCredentials",
"https://standardknowledge.com/ontologies/core/apiKey": "ENV_TICKETMASTER_APIKEY",
"https://standardknowledge.com/ontologies/core/account": "https://example.com/data/TicketmasterAccount1"
"account": "https://example.com/data/TicketmasterAccount1"
},
{
"@id": "https://example.com/integrations/Ticketmaster",
Expand All @@ -80,7 +83,7 @@
"@id": "https://example.com/getEvents",
"@type": "https://standardknowledge.com/ontologies/core/Verb",
"rdfs:label": "getEvents",
"https://standardknowledge.com/ontologies/core/parametersContext": {
"parametersContext": {
"city": {
"@id": "https://example.com/city",
"@type": "http://www.w3.org/2001/XMLSchema#string"
Expand Down Expand Up @@ -726,8 +729,8 @@
{
"@id": "https://example.com/data/TicketmasterOpenApiDescription",
"@type": "https://standardknowledge.com/ontologies/core/OpenApiDescription",
"https://standardknowledge.com/ontologies/core/integration": "https://example.com/integrations/Ticketmaster",
"https://standardknowledge.com/ontologies/core/openApiDescription": {
"integration": "https://example.com/integrations/Ticketmaster",
"skl:openApiDescription": {
"openapi": "3.0.0",
"servers": [
{
Expand Down

0 comments on commit 10c2e9a

Please sign in to comment.