test(encoding): improve test coverage (#4742)

This commit is contained in:
David Luis 2024-05-16 05:58:53 +07:00 committed by GitHub
parent 48506f42c6
commit aa35b3574f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -110,6 +110,7 @@ Deno.test({
fn() { fn() {
assertThrows( assertThrows(
() => decodeBase32("OOOO=="), () => decodeBase32("OOOO=="),
Error,
"Invalid string. Length must be a multiple of 8", "Invalid string. Length must be a multiple of 8",
); );
}, },
@ -119,7 +120,8 @@ Deno.test({
name: "decodeBase32() throws on bad padding", name: "decodeBase32() throws on bad padding",
fn() { fn() {
assertThrows( assertThrows(
() => decodeBase32("OOOO=="), () => decodeBase32("5HXR334AQYAAAA=="),
Error,
"Invalid pad length", "Invalid pad length",
); );
}, },

View File

@ -67,6 +67,7 @@ Deno.test("decodeBase58() decodes binary", () => {
Deno.test("decodeBase58() throws on invalid input", () => { Deno.test("decodeBase58() throws on invalid input", () => {
assertThrows( assertThrows(
() => decodeBase58("+2NEpo7TZRRrLZSi2U"), () => decodeBase58("+2NEpo7TZRRrLZSi2U"),
Error,
`Invalid base58 char at index 0 with value +`, `Invalid base58 char at index 0 with value +`,
); );
}); });