Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Nov 13, 2021
1 parent f6acea5 commit efbdc7d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/unit/test-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ describes.realWin('crypto-impl', {}, (env) => {
}

testSuite('with native crypto API');
testSuite('with crypto lib', {});
testSuite('with crypto lib', {...win, crypto: null});
testSuite('with native crypto API rejects', {
...win,
crypto: {
subtle: {
digest: () => Promise.reject('Operation not supported'),
Expand All @@ -140,6 +141,7 @@ describes.realWin('crypto-impl', {}, (env) => {
testSuite(
'with native crypto API throws',
{
...win,
crypto: {
subtle: {
digest: () => {
Expand All @@ -152,9 +154,10 @@ describes.realWin('crypto-impl', {}, (env) => {
);

it('native API result should exactly equal to crypto lib result', () => {
const fakeWin = {...win, crypto: null};
return Promise.all([
createCrypto(win).sha384('abc'),
createCrypto({}).sha384('abc'),
createCrypto(fakeWin).sha384('abc'),
]).then((results) => {
expect(results[0]).to.jsonEqual(results[1]);
});
Expand Down

0 comments on commit efbdc7d

Please sign in to comment.