AkurAI Build
Menu

popagent

public

Latest change b61deab8cc219052959fa9b2e7525335a79519f8 - Isolate tests and remove terminal tasks by AkurAI Build

import { describe, expect, test } from "bun:test";
import { assertIsolatedTestEnvironment } from "./test-environment";

describe("test database isolation", () => {
  test("rejects application tests without the isolated runner marker", () => {
    expect(() => assertIsolatedTestEnvironment({
      DATABASE_URL: "postgresql://popagent:secret@127.0.0.1:5433/popagent",
      OBSERVABILITY_DATABASE_URL: "postgresql://popagent:secret@127.0.0.1:5435/popagent_observability",
    })).toThrow("./deploy.sh test");
  });

  test("accepts only marked disposable test databases", () => {
    expect(() => assertIsolatedTestEnvironment({
      POPAGENT_ISOLATED_TEST: "1",
      DATABASE_URL: "postgresql://popagent:test-only@127.0.0.1:49152/popagent_test",
      OBSERVABILITY_DATABASE_URL: "postgresql://popagent:test-only@127.0.0.1:49153/popagent_observability_test",
    })).not.toThrow();
    expect(() => assertIsolatedTestEnvironment({
      POPAGENT_ISOLATED_TEST: "1",
      DATABASE_URL: "postgresql://popagent:secret@127.0.0.1:5433/popagent",
      OBSERVABILITY_DATABASE_URL: "postgresql://popagent:secret@127.0.0.1:5435/popagent_observability",
    })).toThrow("disposable test databases");
  });
});