Skip to content

Commit

Permalink
Ignore instead of error on invalid compact IRIs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Mar 16, 2020
1 parent e74b755 commit 8bc5c15
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/JsonLdParser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3874,7 +3874,7 @@ describe('JsonLdParser', () => {
]);
});

it('without @prefix ending on non-gen-delim char should error', async () => {
it('without @prefix ending on non-gen-delim char should be ignored', async () => {
const stream = streamifyString(`
{
"@context": {
Expand All @@ -3883,12 +3883,10 @@ describe('JsonLdParser', () => {
},
"abc:def": "Brew Eats"
}`);
return expect(arrayifyStream(stream.pipe(parser))).rejects.toThrow(new Error(
'Compact IRIs must end with a gen-delim character unless @prefix is set to true, ' +
'found: \'abc\': \'{"@id":"http://ex.org/compact-"}\''));
return expect(await arrayifyStream(stream.pipe(parser))).toBeRdfIsomorphic([]);
});

it('without @prefix in 1.0 ending on non-gen-delim char should error', async () => {
it('without @prefix in 1.0 ending on non-gen-delim char should be ignored', async () => {
const stream = streamifyString(`
{
"@context": {
Expand All @@ -3897,12 +3895,10 @@ describe('JsonLdParser', () => {
},
"abc:def": "Brew Eats"
}`);
return expect(arrayifyStream(stream.pipe(parser))).rejects.toThrow(new Error(
'Compact IRIs must end with a gen-delim character unless @prefix is set to true, ' +
'found: \'abc\': \'{"@id":"http://ex.org/compact-"}\''));
return expect(await arrayifyStream(stream.pipe(parser))).toBeRdfIsomorphic([]);
});

it('with @prefix in 1.0 ending on non-gen-delim char should error', async () => {
it('with @prefix in 1.0 ending on non-gen-delim char should be ignored', async () => {
const stream = streamifyString(`
{
"@context": {
Expand All @@ -3911,9 +3907,7 @@ describe('JsonLdParser', () => {
},
"abc:def": "Brew Eats"
}`);
return expect(arrayifyStream(stream.pipe(parser))).rejects.toThrow(new Error(
'Compact IRIs must end with a gen-delim character unless @prefix is set to true, ' +
'found: \'abc\': \'{"@id":"http://ex.org/compact-","@prefix":true}\''));
return expect(await arrayifyStream(stream.pipe(parser))).toBeRdfIsomorphic([]);
});
});

Expand Down

0 comments on commit 8bc5c15

Please sign in to comment.