From efbdc7dbbb07a246b2a15e3538db603463baabf9 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Sat, 13 Nov 2021 03:38:58 -0500 Subject: [PATCH] fix test --- test/unit/test-crypto.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/unit/test-crypto.js b/test/unit/test-crypto.js index 9fed50b043b0d..657d591691cbe 100644 --- a/test/unit/test-crypto.js +++ b/test/unit/test-crypto.js @@ -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'), @@ -140,6 +141,7 @@ describes.realWin('crypto-impl', {}, (env) => { testSuite( 'with native crypto API throws', { + ...win, crypto: { subtle: { digest: () => { @@ -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]); });