From 788b958e200708348f575e5c8076a367c1133f6f Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Wed, 2 Jun 2021 13:31:50 -0700 Subject: [PATCH] refactor: update hash fn in test config --- test/config.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/config.ts b/test/config.ts index a4c230d3f..d8e11db5e 100644 --- a/test/config.ts +++ b/test/config.ts @@ -8,21 +8,21 @@ import { Config, globalSetup, } from "@playwright/test" -import * as bcrypt from "bcrypt" +import * as argon2 from "argon2" import path from "path" import { PASSWORD } from "./utils/constants" import * as wtfnode from "./utils/wtfnode" // Playwright doesn't like that ../src/node/util has an enum in it // so I had to copy hash in separately -const hash = (str: string): string => { - return bcrypt.hashSync(str, 10) +const hash = async (str: string): Promise => { + return await argon2.hash(str) } const cookieToStore = { sameSite: "Lax" as const, name: "key", - value: hash(PASSWORD), + value: "", domain: "localhost", path: "/", expires: -1, @@ -38,6 +38,8 @@ globalSetup(async () => { wtfnode.setup() } + cookieToStore.value = await hash(PASSWORD) + const storage = { cookies: [cookieToStore], }