Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
test: cover all entry point content
Browse files Browse the repository at this point in the history
Makes sure that all quads in the entry point are tested.
  • Loading branch information
thewilkybarkid authored Mar 13, 2020
1 parent 52eb54e commit de056d7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/routes/entry-point.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { namedNode, quad } from '@rdfjs/data-model';
import { literal, namedNode, quad } from '@rdfjs/data-model';
import { OK } from 'http-status-codes';
import 'jest-rdf';
import { Response } from 'koa';
Expand All @@ -23,9 +23,21 @@ describe('entry-point', (): void => {
const { dataset } = await makeRequest();
const id = namedNode('http://example.com/path-to/entry-point');

expect(dataset).toBeRdfDatasetContaining(quad(id, rdf.type, schema.EntryPoint));
expect(dataset).toBeRdfDatasetMatching({ subject: id, predicate: schema('name') });
expect(dataset).toBeRdfDatasetMatching({ subject: id, predicate: hydra.collection });
expect(dataset).toBeRdfDatasetContaining(
quad(id, rdf.type, schema.EntryPoint),
quad(id, schema('name'), literal('Article Store', 'en')),
);
});

it('should return the article list', async (): Promise<void> => {
const { dataset } = await makeRequest();
const id = namedNode('http://example.com/path-to/entry-point');
const collection = namedNode('http://example.com/path-to/article-list');

expect(dataset).toBeRdfDatasetContaining(
quad(id, hydra.collection, collection),
quad(collection, rdf.type, hydra.Collection),
);
});

it('should call the next middleware', async (): Promise<void> => {
Expand Down

0 comments on commit de056d7

Please sign in to comment.