Update tests to match new error output, and add additional test for bad header parameter

This commit is contained in:
GCHQDeveloper581 2026-05-29 14:51:19 +00:00
parent 3b9914f8e2
commit cc1d4582bd
No known key found for this signature in database
GPG Key ID: 6222E059A3DF595C

View File

@ -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",