This commit is contained in:
Adria Navarro 2024-01-02 17:03:13 +01:00
parent b0a12e034d
commit fe0ac28851
1 changed files with 14 additions and 8 deletions

View File

@ -24,7 +24,7 @@ describe("auth", () => {
])( ])(
`can use passwords up to ${PASSWORD_MAX_LENGTH} characters in length`, `can use passwords up to ${PASSWORD_MAX_LENGTH} characters in length`,
password => { password => {
expect(validatePassword(password as string)).toEqual({ expect(validatePassword(password)).toEqual({
valid: true, valid: true,
}) })
} }
@ -32,12 +32,18 @@ describe("auth", () => {
it.each([ it.each([
generator.word({ length: PASSWORD_MAX_LENGTH + 1 }), generator.word({ length: PASSWORD_MAX_LENGTH + 1 }),
generator.paragraph().substring(0, PASSWORD_MAX_LENGTH + 1), generator
])("limit password length", password => { .paragraph({ sentences: 50 })
expect(validatePassword(password as string)).toEqual({ .substring(0, PASSWORD_MAX_LENGTH + 1),
valid: false, ])(
error: "Password invalid. Maximum 512 characters.", `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.",
})
}
)
}) })
}) })