Files
testcontainers/tests/postgres.test.ts
2024-07-19 19:49:22 +02:00

23 lines
600 B
TypeScript

import { assertArrayIncludes } from "@std/assert";
import { afterAll, describe, it } from "@std/testing/bdd";
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 }]);
});
});