add tests that boxed strings are not valid values for options

This commit is contained in:
Kevin Gibbons 2024-03-11 22:47:43 -07:00 committed by Jordan Harband
parent 6d7bd55175
commit 070d7ee87e
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
3 changed files with 25 additions and 0 deletions

View File

@ -7,6 +7,15 @@ includes: [compareArray.js]
features: [uint8array-base64]
---*/
assert.throws(TypeError, function() {
Uint8Array.fromBase64("Zg==", { alphabet: Object("base64") });
});
assert.throws(TypeError, function() {
Uint8Array.fromBase64("Zg==", { lastChunkHandling: Object("loose") });
});
var toStringCalls = 0;
var throwyToString = {
toString: function() {

View File

@ -7,6 +7,17 @@ includes: [compareArray.js]
features: [uint8array-base64]
---*/
assert.throws(TypeError, function() {
var target = new Uint8Array([255, 255, 255]);
target.setFromBase64("Zg==", { alphabet: Object("base64") });
});
assert.throws(TypeError, function() {
var target = new Uint8Array([255, 255, 255]);
target.setFromBase64("Zg==", { lastChunkHandling: Object("strict") });
});
var toStringCalls = 0;
var throwyToString = {
toString: function() {

View File

@ -6,6 +6,11 @@ description: Uint8Array.prototype.toBase64 triggers effects of the "alphabet" ge
features: [uint8array-base64]
---*/
assert.throws(TypeError, function() {
(new Uint8Array(2)).toBase64({ alphabet: Object("base64") });
});
var toStringCalls = 0;
var throwyToString = {
toString: function() {