Skip to content

Commit

Permalink
Add inputFormat tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlehn committed May 19, 2023
1 parent 816c181 commit 5bae7e7
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Misc tests.
*/
// disable so tests can be copy & pasted
/* eslint-disable quotes, quote-props */
const rdfCanonize = require('..');
const assert = require('assert');

describe.only('API tests', () => {
it('should reject invalid inputFormat', async () => {
let error;
try {
await rdfCanonize.canonize('', {
algorithm: 'URDNA2015',
inputFormat: 'application/bogus',
format: 'application/n-quads'
});
} catch(e) {
error = e;
}
assert(error);
});

it('should fail to parse empty dataset as N-Quads', async () => {
let error;
try {
await rdfCanonize.canonize([], {
algorithm: 'URDNA2015',
inputFormat: 'application/bogus',
format: 'application/n-quads'
});
} catch(e) {
error = e;
}
assert(error);
});

it('should fail to parse empty legacy dataset as N-Quads', async () => {
let error;
try {
await rdfCanonize.canonize({}, {
algorithm: 'URDNA2015',
inputFormat: 'application/bogus',
format: 'application/n-quads'
});
} catch(e) {
error = e;
}
assert(error);
});
});

0 comments on commit 5bae7e7

Please sign in to comment.