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]); });