Skip to content

Commit 916d701

Browse files
committed
Add expand and toRDF for non-IRI test.
1 parent 96ce33b commit 916d701

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tests/misc.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,61 @@ _:b0 <ex:p> "v" .
34163416
});
34173417
});
34183418
});
3419+
3420+
describe('various', () => {
3421+
it('expand and toRDF for non-IRI', async () => {
3422+
const input =
3423+
{
3424+
"@context": {
3425+
"ex": "urn:ex#",
3426+
"ex:prop": {
3427+
"@type": "@id"
3428+
}
3429+
},
3430+
"@id": "urn:id",
3431+
"@type": "ex:type",
3432+
"ex:prop": "value"
3433+
}
3434+
;
3435+
const expanded =
3436+
[
3437+
{
3438+
"@id": "urn:id",
3439+
"@type": [
3440+
"urn:ex#type"
3441+
],
3442+
"urn:ex#prop": [
3443+
{
3444+
"@id": "value"
3445+
}
3446+
]
3447+
}
3448+
]
3449+
;
3450+
const nq = `\
3451+
<urn:id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex#type> .
3452+
`;
3453+
3454+
await _test({
3455+
type: 'expand',
3456+
input,
3457+
expected: expanded,
3458+
eventCodeLog: [],
3459+
testSafe: true
3460+
});
3461+
await _test({
3462+
type: 'toRDF',
3463+
input: expanded,
3464+
options: {skipExpansion: true},
3465+
expected: nq,
3466+
eventCodeLog: [
3467+
'relative object reference'
3468+
// .. 'value'
3469+
],
3470+
testNotSafe: true
3471+
});
3472+
});
3473+
});
34193474
});
34203475

34213476
describe('safe canonize defaults', () => {

0 commit comments

Comments
 (0)