Spaces:
Running
Running
Download Frontend/src/utils/passwordValidation.test.js from ritesh19180/ai-helpdesk-api: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/ritesh19180/ai-helpdesk-api/resolve/main/Frontend/src/utils/passwordValidation.test.js
- Command line
-
hf download hf://spaces/ritesh19180/ai-helpdesk-api/Frontend/src/utils/passwordValidation.test.js
-
curl -L -o passwordValidation.test.js https://huggingface.co/spaces/ritesh19180/ai-helpdesk-api/resolve/main/Frontend/src/utils/passwordValidation.test.js
1.06 kB
| import test from "node:test"; | |
| import assert from "node:assert/strict"; | |
| import { | |
| getPasswordValidation, | |
| getPasswordValidationMessage, | |
| hasSequentialCharacters, | |
| } from "./passwordValidation.js"; | |
| test("detects common keyboard and numeric sequences", () => { | |
| assert.equal(hasSequentialCharacters("safeQwe9!"), true); | |
| assert.equal(hasSequentialCharacters("Ticket123!"), true); | |
| assert.equal(hasSequentialCharacters("Route975!"), false); | |
| }); | |
| test("validates required password rules", () => { | |
| const checks = getPasswordValidation("Support9!", { | |
| minLength: 8, | |
| requireUppercase: true, | |
| requireNumber: true, | |
| requireSpecial: true, | |
| }); | |
| assert.deepEqual(checks, { | |
| hasValue: true, | |
| minLength: true, | |
| uppercase: true, | |
| number: true, | |
| special: true, | |
| noSequence: true, | |
| }); | |
| }); | |
| test("returns the first actionable validation message", () => { | |
| const checks = getPasswordValidation("abc123", { minLength: 8 }); | |
| assert.equal(getPasswordValidationMessage(checks, { minLength: 8 }), "Use at least 8 characters."); | |
| }); | |