MCPcopy Index your code
hub / github.com/nodejs/node / testError

Function testError

test/fixtures/wpt/WebCryptoAPI/generateKey/failures.js:81–94  ·  view source on GitHub ↗
(algorithm, extractable, usages, expectedError, testTag)

Source from the content-addressed store, hash-verified

79 // Expected error is either a number, tested against the error code,
80 // or a string, tested against the error name.
81 function testError(algorithm, extractable, usages, expectedError, testTag) {
82 promise_test(function(test) {
83 return crypto.subtle.generateKey(algorithm, extractable, usages)
84 .then(function(result) {
85 assert_unreached("Operation succeeded, but should not have");
86 }, function(err) {
87 if (typeof expectedError === "number") {
88 assert_equals(err.code, expectedError, testTag + " not supported");
89 } else {
90 assert_equals(err.name, expectedError, testTag + " not supported");
91 }
92 });
93 }, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
94 }
95
96
97 // Given an algorithm name, create several invalid parameters.

Callers 1

run_testFunction · 0.70

Calls 5

parameterStringFunction · 0.70
promise_testFunction · 0.50
assert_unreachedFunction · 0.50
assert_equalsFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected