mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
feat: add minLength to pw strategy, and enforce
This commit is contained in:
13
app/__test__/auth/strategies/PasswordStrategy.spec.ts
Normal file
13
app/__test__/auth/strategies/PasswordStrategy.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { PasswordStrategy } from "auth/authenticate/strategies/PasswordStrategy";
|
||||
import { describe, expect, it } from "bun:test";
|
||||
|
||||
describe("PasswordStrategy", () => {
|
||||
it("should enforce provided minimum length", async () => {
|
||||
const strategy = new PasswordStrategy({ minLength: 8, hashing: "plain" });
|
||||
|
||||
expect(strategy.verify("password")({} as any)).rejects.toThrow();
|
||||
expect(
|
||||
strategy.verify("password1234")({ strategy_value: "password1234" } as any),
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user