Base64 operations now throw a meaningful error if the alphabet is the wrong length

This commit is contained in:
n1474335 2019-10-15 16:25:52 +01:00
parent 3472484601
commit 834ff95702
2 changed files with 11 additions and 5 deletions

View file

@ -885,17 +885,17 @@ smothering ampersand abreast
it("toBase64: editableOption", () => {
const result = toBase64("some input", {
alphabet: {
value: "0-9A-W"
value: "0-9A-W+/a-zXYZ="
},
});
assert.strictEqual(result.toString(), "SPI1R1T0");
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
}),
it("toBase64: editableOptions key is value", () => {
const result = toBase64("some input", {
alphabet: "0-9A-W",
alphabet: "0-9A-W+/a-zXYZ=",
});
assert.strictEqual(result.toString(), "SPI1R1T0");
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
}),
it("toBase64: editableOptions default", () => {