mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 04:35:25 +00:00
refactor: update hash fn in test config
This commit is contained in:
parent
1134780b8b
commit
788b958e20
@ -8,21 +8,21 @@ import {
|
|||||||
Config,
|
Config,
|
||||||
globalSetup,
|
globalSetup,
|
||||||
} from "@playwright/test"
|
} from "@playwright/test"
|
||||||
import * as bcrypt from "bcrypt"
|
import * as argon2 from "argon2"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { PASSWORD } from "./utils/constants"
|
import { PASSWORD } from "./utils/constants"
|
||||||
import * as wtfnode from "./utils/wtfnode"
|
import * as wtfnode from "./utils/wtfnode"
|
||||||
|
|
||||||
// Playwright doesn't like that ../src/node/util has an enum in it
|
// Playwright doesn't like that ../src/node/util has an enum in it
|
||||||
// so I had to copy hash in separately
|
// so I had to copy hash in separately
|
||||||
const hash = (str: string): string => {
|
const hash = async (str: string): Promise<string> => {
|
||||||
return bcrypt.hashSync(str, 10)
|
return await argon2.hash(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
const cookieToStore = {
|
const cookieToStore = {
|
||||||
sameSite: "Lax" as const,
|
sameSite: "Lax" as const,
|
||||||
name: "key",
|
name: "key",
|
||||||
value: hash(PASSWORD),
|
value: "",
|
||||||
domain: "localhost",
|
domain: "localhost",
|
||||||
path: "/",
|
path: "/",
|
||||||
expires: -1,
|
expires: -1,
|
||||||
@ -38,6 +38,8 @@ globalSetup(async () => {
|
|||||||
wtfnode.setup()
|
wtfnode.setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cookieToStore.value = await hash(PASSWORD)
|
||||||
|
|
||||||
const storage = {
|
const storage = {
|
||||||
cookies: [cookieToStore],
|
cookies: [cookieToStore],
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user