test: create lib function for getting mocked env variables

This commit is contained in:
2024-06-15 06:01:19 -04:00
parent be2e7ffa98
commit df7e7432da
6 changed files with 51 additions and 35 deletions

View File

@@ -45,15 +45,13 @@
"",
"import app from \"~/index\";",
"import { server } from \"~/mocks\";",
"import { getDb, resetDb } from \"~/models/db\";",
"import { resetDb } from \"~/models/db\";",
"import { getTestDb } from \"~/libs/test/getTestDb\";",
"",
"server.listen();",
"",
"describe(\"requests the /$1 route\", () => {",
" const db = getDb({",
" TURSO_URL: process.env.TURSO_URL ?? \"http://127.0.0.1:3000\",",
" TURSO_AUTH_TOKEN: process.env.TURSO_AUTH_TOKEN ?? \"asd\",",
" });",
" const db = getTestDb();",
"",
" beforeEach(async () => {",
" await resetDb();",