Files
testcontainers/tests/postgres.test.ts
2024-07-06 21:26:38 +02:00

23 lines
608 B
TypeScript

import { assertArrayIncludes } from "std/assert/mod.ts";
import { afterAll, describe, it } from "std/testing/bdd.ts";
import { PostgresTestContainer } from "../containers/postgres.ts";
const DB_NAME = "sandbox";
const container = await PostgresTestContainer.start("postgres:14");
await container.create(DB_NAME);
const sql = await container.client(DB_NAME);
describe("Postgres", () => {
afterAll(async () => {
await container.stop();
});
it("should spin up a postgres container", async () => {
const res = await sql`SELECT 1`;
assertArrayIncludes(res, [{ "?column?": 1 }]);
});
});