From fe0ac2885160324116e15d1f4cdef060433f3c28 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 2 Jan 2024 17:03:13 +0100 Subject: [PATCH] Fix test --- .../src/security/tests/auth.spec.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/backend-core/src/security/tests/auth.spec.ts b/packages/backend-core/src/security/tests/auth.spec.ts index 46ebfae655..8a77646885 100644 --- a/packages/backend-core/src/security/tests/auth.spec.ts +++ b/packages/backend-core/src/security/tests/auth.spec.ts @@ -24,7 +24,7 @@ describe("auth", () => { ])( `can use passwords up to ${PASSWORD_MAX_LENGTH} characters in length`, password => { - expect(validatePassword(password as string)).toEqual({ + expect(validatePassword(password)).toEqual({ valid: true, }) } @@ -32,12 +32,18 @@ describe("auth", () => { it.each([ generator.word({ length: PASSWORD_MAX_LENGTH + 1 }), - generator.paragraph().substring(0, PASSWORD_MAX_LENGTH + 1), - ])("limit password length", password => { - expect(validatePassword(password as string)).toEqual({ - valid: false, - error: "Password invalid. Maximum 512 characters.", - }) - }) + generator + .paragraph({ sentences: 50 }) + .substring(0, PASSWORD_MAX_LENGTH + 1), + ])( + `passwords cannot have more than ${PASSWORD_MAX_LENGTH} characters`, + password => { + console.error(password) + expect(validatePassword(password)).toEqual({ + valid: false, + error: "Password invalid. Maximum 512 characters.", + }) + } + ) }) })