Skip to content

Commit

Permalink
add failing test for JSON-LD fetching problem
Browse files Browse the repository at this point in the history
  • Loading branch information
angelo-v committed Jul 19, 2020
1 parent 91a56c9 commit b8c9901
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/unit/fetcher-jsonld-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as rdf from '../../src';

const nock = require('nock')
import chai from 'chai'

const {expect} = chai

describe('Given a JSON-LD resource', () => {

const uri = "http://localhost/jsonld#it"

beforeEach(() => {
const docContents = `
{
"@id": ${uri},
"https://predicate.example": "value"
}
`
nock('http://localhost').get('/jsonld').reply(200, docContents, {
'Content-Type': 'application/ld+json',
})
});

describe('when it is fetched to the store', () => {

let fetcher, store;
beforeEach(() => {
store = rdf.graph();
fetcher = rdf.fetcher(store);
});

it('then the triples from the document can be found in the store', async () => {
await fetcher.load(uri);
const match = store.anyStatementMatching(rdf.sym(uri))
expect(match).to.be.ok()
});
});


});

0 comments on commit b8c9901

Please sign in to comment.