fix: align auth test timeout formatting

This commit is contained in:
Thomas Brugman
2025-10-24 18:22:13 +02:00
parent 74b0305383
commit 1cf643d6b0
2 changed files with 13 additions and 18 deletions

View File

@@ -118,23 +118,19 @@ describe("Auth Utils", () => {
expect(isValid).toBe(false);
});
test(
"should generate different hashes for same password",
async () => {
// Hash twice in parallel so the test doesn't incur two full bcrypt rounds sequentially.
// Running them concurrently keeps the assertion meaningful while avoiding unnecessary timeouts.
const [hash1, hash2] = await Promise.all([
hashPassword(password),
hashPassword(password),
]);
// Bcrypt with a cost factor of 12 can outlive Vitest's 5s default when CI hosts are busy.
test("should generate different hashes for same password", async () => {
// Hash twice in parallel so the test doesn't incur two full bcrypt rounds sequentially.
// Running them concurrently keeps the assertion meaningful while avoiding unnecessary timeouts.
const [hash1, hash2] = await Promise.all([
hashPassword(password),
hashPassword(password),
]);
expect(hash1).not.toBe(hash2);
expect(await verifyPassword(password, hash1)).toBe(true);
expect(await verifyPassword(password, hash2)).toBe(true);
},
// Bcrypt with a cost factor of 12 can outlive Vitest's 5s default when CI hosts are busy.
15000
);
expect(hash1).not.toBe(hash2);
expect(await verifyPassword(password, hash1)).toBe(true);
expect(await verifyPassword(password, hash2)).toBe(true);
}, 15000);
test("should hash complex passwords correctly", async () => {
const complexPassword = "MyC0mpl3x!P@ssw0rd#2024$%^&*()";

View File

@@ -46,8 +46,7 @@ export function LanguageSelect({ language, onLanguageChange, disabled, locale }:
// Most ISO entries don't ship with every locale translation, so fall back to
// English to keep the dropdown readable for locales such as Dutch that were
// added recently.
const getLabelForLocale = (item: TIso639Language) =>
item.label[locale] ?? item.label["en-US"];
const getLabelForLocale = (item: TIso639Language) => item.label[locale] ?? item.label["en-US"];
const filteredItems = items.filter((item) =>
getLabelForLocale(item).toLowerCase().includes(searchTerm.toLowerCase())