From cc1d4582bd90dc90a321057000348281699c7bd7 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Fri, 29 May 2026 14:51:19 +0000 Subject: [PATCH] Update tests to match new error output, and add additional test for bad header parameter --- tests/operations/tests/JWTSign.mjs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/operations/tests/JWTSign.mjs b/tests/operations/tests/JWTSign.mjs index 9954174b..7a1a0a4b 100644 --- a/tests/operations/tests/JWTSign.mjs +++ b/tests/operations/tests/JWTSign.mjs @@ -89,6 +89,19 @@ TestRegister.addTests([ } ], }, + { + name: "JWT Sign: HS256, invalid header", + input: inputObject, + expectedOutput: `Header must be a valid (or empty) json object. + +SyntaxError: Unexpected token 'h', "this is not JSON" is not valid JSON`, + recipeConfig: [ + { + op: "JWT Sign", + args: [hsKey, "HS256", "this is not JSON"], + } + ], + }, { name: "JWT Sign: HS256 with custom header", input: inputObject, @@ -142,7 +155,7 @@ TestRegister.addTests([ input: inputObject, expectedOutput: `Error: Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA. -Error: "alg" parameter "ES384" requires curve "secp384r1".`, +DataError: Named curve mismatch`, recipeConfig: [ { op: "JWT Sign", @@ -189,7 +202,7 @@ Error: "alg" parameter "ES384" requires curve "secp384r1".`, input: inputObject, expectedOutput: `Error: Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA. -Error: secretOrPrivateKey has a minimum key size of 2048 bits for RS256`, +TypeError: RS256 requires key modulusLength to be 2048 bits or larger`, recipeConfig: [ { op: "JWT Sign",