Skip to content

Commit

Permalink
add common mustCall to promise chain
Browse files Browse the repository at this point in the history
  • Loading branch information
obi-el committed Mar 7, 2021
1 parent c784380 commit 8789234
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-webcrypto-export-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
name: 'HMAC'
}, false, ['sign', 'verify']), {
code: 'ERR_MISSING_OPTION'
});
}).then(common.mustCall());
assert.rejects(
subtle.importKey('raw', keyData, {
name: 'HMAC',
hash: 'SHA-256'
}, false, ['deriveBits']), {
name: 'SyntaxError',
message: 'Unsupported key usage for an HMAC key'
});
}).then(common.mustCall());
assert.rejects(
subtle.importKey('node.keyObject', '', {
name: 'HMAC',
hash: 'SHA-256'
}, false, ['sign', 'verify']), {
code: 'ERR_INVALID_ARG_TYPE'
});
}).then(common.mustCall());
assert.rejects(
subtle.importKey('raw', keyData, {
name: 'HMAC',
Expand All @@ -55,7 +55,7 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
}, false, ['sign', 'verify']), {
name: 'DataError',
message: 'Zero-length key is not supported'
});
}).then(common.mustCall());
assert.rejects(
subtle.importKey('raw', keyData, {
name: 'HMAC',
Expand All @@ -64,15 +64,15 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
}, false, ['sign', 'verify']), {
name: 'DataError',
message: 'Invalid key length'
});
}).then(common.mustCall());
assert.rejects(
subtle.importKey('jwk', null, {
name: 'HMAC',
hash: 'SHA-256',
}, false, ['sign', 'verify']), {
name: 'DataError',
message: 'Invalid JWK keyData'
});
}).then(common.mustCall());
}

// Import/Export HMAC Secret Key
Expand Down

0 comments on commit 8789234

Please sign in to comment.