-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add failing test for JSON-LD fetching problem
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}); | ||
}); | ||
|
||
|
||
}); |