mirror of
https://github.com/danbulant/jose
synced 2026-05-24 20:41:46 +00:00
23 lines
683 B
JavaScript
23 lines
683 B
JavaScript
import test from 'ava';
|
|
|
|
const root = !('WEBCRYPTO' in process.env) ? '#dist' : '#dist/webcrypto';
|
|
import(`${root}/jws/compact/verify`).then(
|
|
({ default: flattenedVerify }) => {
|
|
test('JWS format validation', async (t) => {
|
|
await t.throwsAsync(flattenedVerify(null, new Uint8Array(0)), {
|
|
message: 'Compact JWS must be a string or Uint8Array',
|
|
code: 'ERR_JWS_INVALID',
|
|
});
|
|
await t.throwsAsync(flattenedVerify('.....', new Uint8Array(0)), {
|
|
message: 'Invalid Compact JWS',
|
|
code: 'ERR_JWS_INVALID',
|
|
});
|
|
});
|
|
},
|
|
(err) => {
|
|
test('failed to import', (t) => {
|
|
console.error(err);
|
|
t.fail();
|
|
});
|
|
},
|
|
);
|