Skip to content

Commit

Permalink
Improve graph tests.
Browse files Browse the repository at this point in the history
- Use URNs for tests that fail on "only @id" cases.
- Update property names.
  • Loading branch information
davidlehn committed Aug 31, 2023
1 parent aa7bd3e commit df22d31
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (1)', async () => {
it('should emit for @graph with only @id (1)', async () => {
const input =
{
"@context": {
Expand All @@ -1962,7 +1962,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
}
},
"@id": "urn:id",
"p": ["rel"]
"p": ["urn:id0"]
}
;
const expected = [];
Expand All @@ -1979,7 +1979,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (2)', async () => {
it('should emit for @graph with only @id (2)', async () => {
const input =
{
"@context": {
Expand All @@ -1991,8 +1991,8 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
},
"@id": "urn:id",
"p": [
"rel0",
"rel1"
"urn:id0",
"urn:id1"
]
}
;
Expand All @@ -2011,7 +2011,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (3)', async () => {
it('should emit for @graph with only @id (3)', async () => {
const input =
{
"@context": {
Expand All @@ -2024,10 +2024,10 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
"@id": "urn:g0",
"p": [
{
"@id": "urn:g1",
"urn:p1": "v1"
"@id": "urn:id0",
"urn:p0": "v0"
},
"rel"
"urn:id1"
]
}
;
Expand All @@ -2039,10 +2039,10 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
{
"@graph": [
{
"@id": "urn:g1",
"urn:p1": [
"@id": "urn:id0",
"urn:p0": [
{
"@value": "v1"
"@value": "v0"
}
]
}
Expand All @@ -2064,7 +2064,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (4)', async () => {
it('should emit for @graph with only @id (4)', async () => {
const input =
{
"@context": {
Expand All @@ -2076,9 +2076,9 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
},
"@id": "urn:g0",
"p": [
"rel",
"urn:id0",
{
"@id": "urn:g1",
"@id": "urn:id1",
"urn:p1": "v1"
}
]
Expand All @@ -2092,7 +2092,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
{
"@graph": [
{
"@id": "urn:g1",
"@id": "urn:id1",
"urn:p1": [
{
"@value": "v1"
Expand All @@ -2117,7 +2117,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (5)', async () => {
it('should emit for @graph with only @id (5)', async () => {
const input =
{
"@context": {
Expand All @@ -2132,7 +2132,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
},
"@id": "urn:id",
"urn:t": "urn:id",
"p": ["rel"]
"p": ["urn:id0"]
}
;
const expected =
Expand All @@ -2159,7 +2159,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
});
});

it('should emit for @graph with relative @id (6)', async () => {
it('should emit for @graph with only @id (6)', async () => {
const input =
{
"@context": {
Expand All @@ -2174,7 +2174,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
},
"@id": "urn:id",
"urn:t": "urn:id",
"p": "rel"
"p": "urn:id0"
}
;
const expected =
Expand Down Expand Up @@ -2218,7 +2218,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
"urn:t": "urn:id",
"p": {
"@id": "rel",
"urn:t": "urn:id2"
"urn:t": "urn:id0"
}
}
;
Expand All @@ -2238,7 +2238,7 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
"@id": "rel",
"urn:t": [
{
"@id": "urn:id2"
"@id": "urn:id0"
}
]
}
Expand Down

0 comments on commit df22d31

Please sign in to comment.