Mercurial > code > home > repos > streamed-graph
annotate src/layout/json_ld_quads.test.ts @ 143:5adf79d4a9f4
release v0.11.0
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 13:29:48 -0700 |
parents | 2468f2227d22 |
children |
rev | line source |
---|---|
36 | 1 import { eachJsonLdQuad } from "./json_ld_quads"; |
2 import { Literal, DataFactory } from "n3"; | |
29
45ed53428e74
fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents:
20
diff
changeset
|
3 const { literal } = DataFactory; |
17 | 4 |
29
45ed53428e74
fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents:
20
diff
changeset
|
5 describe("eachJsonLdQuad", () => { |
36 | 6 test("finds multiple graphs", () => {}); |
7 test("returns quads", async () => { | |
8 let results: Array<any> = []; | |
9 await eachJsonLdQuad( | |
10 [ | |
11 { | |
12 "@id": "http://example.com/g1", | |
13 "@graph": [ | |
29
45ed53428e74
fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents:
20
diff
changeset
|
14 { |
36 | 15 "@id": "http://example.com/s1", |
16 "http://example.com/p1": [{ "@value": "lit1" }] | |
29
45ed53428e74
fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents:
20
diff
changeset
|
17 } |
36 | 18 ] |
19 } | |
20 ], | |
21 (res: any) => results.push(res) | |
22 ); | |
23 expect(results).toHaveLength(1); | |
24 expect(results[0].subject.value).toEqual("http://example.com/s1"); | |
25 expect(results[0].predicate.value).toEqual("http://example.com/p1"); | |
26 expect((results[0].object as Literal).equals(literal("lit1"))).toBeTruthy(); | |
27 expect(results[0].graph.value).toEqual("http://example.com/g1"); | |
28 }); | |
29 }); |