Skip to content

Commit 841fd07

Browse files
committed
refactor: update hash fn in test config
1 parent bbc7099 commit 841fd07

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import {
88
Config,
99
globalSetup,
1010
} from "@playwright/test"
11-
import * as bcrypt from "bcrypt"
11+
import * as argon2 from "argon2"
1212
import path from "path"
1313
import { PASSWORD } from "./utils/constants"
1414
import * as wtfnode from "./utils/wtfnode"
1515

1616
// Playwright doesn't like that ../src/node/util has an enum in it
1717
// so I had to copy hash in separately
18-
const hash = (str: string): string => {
19-
return bcrypt.hashSync(str, 10)
18+
const hash = async (str: string): Promise<string> => {
19+
return await argon2.hash(str)
2020
}
2121

2222
const cookieToStore = {
2323
sameSite: "Lax" as const,
2424
name: "key",
25-
value: hash(PASSWORD),
25+
value: "",
2626
domain: "localhost",
2727
path: "/",
2828
expires: -1,
@@ -38,6 +38,8 @@ globalSetup(async () => {
3838
wtfnode.setup()
3939
}
4040

41+
cookieToStore.value = await hash(PASSWORD)
42+
4143
const storage = {
4244
cookies: [cookieToStore],
4345
}

0 commit comments

Comments
 (0)