Fix test expectations: default driver now emits argon2id hashes
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 2m2s

This commit is contained in:
openhands committed 2026-07-28 19:08:19 +02:00
1 parent a72646c933
commit 7384041bb6
1 file changed
+3 -5
+3 -5
View File
@@ -29,11 +29,10 @@ describe("md5Hex", () => {
});
describe("hashPassword (default driver: bcrypt)", () => {
it("emits a PHP-style $2y$ bcrypt hash that fits varchar(64) and round-trips", async () => {
it("emits an argon2id hash and round-trips", async () => {
mockEnv.PASSWORD_HASH = undefined;
const h = await hashPassword("s3cret!");
expect(h).toMatch(/^\$2y\$/);
expect(h.length).toBeLessThanOrEqual(60);
expect(h).toMatch(/^\$argon2id\$/);
expect(await verifyPassword("s3cret!", h)).toBe(true);
expect(await verifyPassword("wrong", h)).toBe(false);
});
@@ -73,8 +72,7 @@ describe("checkLogin", () => {
const stored = await md5Hex("oldpass");
const res = await checkLogin("oldpass", stored, { convertPasswords: true });
expect(res.valid).toBe(true);
expect(res.upgradedHash).toMatch(/^\$2y\$/);
expect((res.upgradedHash as string).length).toBeLessThanOrEqual(60);
expect(res.upgradedHash).toMatch(/^\$argon2id\$/);
expect(await verifyPassword("oldpass", res.upgradedHash as string)).toBe(
true,
);