Skip to content

Commit

Permalink
test: wrong endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jan 14, 2025
1 parent cd21e67 commit 3990a4b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/hydra/test/collection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ describe('@kopflos-cms/hydra', () => {
const pointer = $rdf.clownface({ dataset }).node(collection)
expect(pointer.out(ns.hydra.member).terms).to.have.length.above(200)
})

it('should fail when endpoint is not configured', async function () {
// given
const kopflos = await startKopflos()

// when
const collection = ex['countries/wrong-endpoint']
const res = await kopflos.handleRequest({
method: 'GET',
iri: collection,
headers: {},
query: {},
body: {} as Body,
})

// then
expect(res.status).to.equal(500)
})
})
})

Expand Down
17 changes: 17 additions & 0 deletions packages/hydra/test/collection.test.ts.trig
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,20 @@ GRAPH <countries/from-lindas> {
] ;
.
}

GRAPH <countries/wrong-endpoint> {
<countries/wrong-endpoint>
a hydra:Collection ;
hydra:memberAssertion
[
hydra:property rdf:type ;
hydra:object schema:Country ;
] ;
kl:endpoint "foobar" ;
kl-hydra:memberShape
[
sh:property [ sh:path schema:name ] ;
sh:property [ sh:path schema:identifier ] ;
] ;
.
}

0 comments on commit 3990a4b

Please sign in to comment.