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

@@ -4,17 +4,15 @@ import { DateTime } from "luxon";
import { beforeEach, describe, expect, it } from "bun:test";
import app from "~/index";
import { getTestDb } from "~/libs/test/getTestDb";
import { server } from "~/mocks";
import { getDb, resetDb } from "~/models/db";
import { resetDb } from "~/models/db";
import { deviceTokensTable } from "~/models/schema";
server.listen();
describe("requests the /token 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();