From f1089c38c31941851fb71e5a684a00c914a7ece6 Mon Sep 17 00:00:00 2001 From: babiabeo Date: Wed, 15 May 2024 22:20:51 +0700 Subject: [PATCH] test(encoding): improve test coverage --- encoding/base32_test.ts | 4 +++- encoding/base58_test.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/encoding/base32_test.ts b/encoding/base32_test.ts index 13b8fdba9f70..6558b5d9c448 100644 --- a/encoding/base32_test.ts +++ b/encoding/base32_test.ts @@ -110,6 +110,7 @@ Deno.test({ fn() { assertThrows( () => decodeBase32("OOOO=="), + Error, "Invalid string. Length must be a multiple of 8", ); }, @@ -119,7 +120,8 @@ Deno.test({ name: "decodeBase32() throws on bad padding", fn() { assertThrows( - () => decodeBase32("OOOO=="), + () => decodeBase32("5HXR334AQYAAAA=="), + Error, "Invalid pad length", ); }, diff --git a/encoding/base58_test.ts b/encoding/base58_test.ts index 77403aa02498..a1cc84b7e64b 100644 --- a/encoding/base58_test.ts +++ b/encoding/base58_test.ts @@ -67,6 +67,7 @@ Deno.test("decodeBase58() decodes binary", () => { Deno.test("decodeBase58() throws on invalid input", () => { assertThrows( () => decodeBase58("+2NEpo7TZRRrLZSi2U"), + Error, `Invalid base58 char at index 0 with value +`, ); });