Tactical Media Broadcast Hub — initial release
Self-hosted multi-platform broadcast newsroom for activist collectives: publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style column wall with hostile-content-safe rendering, live control room with Auto Director, bridged chat governance with polls and quorum, distributed sandboxed transcode workers, encrypted content-addressed archive, monthly analytics. MIT licensed. See README.md and docs/.
This commit is contained in:
commit
aa5e262f3a
880 changed files with 111042 additions and 0 deletions
28
packages/egress/src/test-db.ts
Normal file
28
packages/egress/src/test-db.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { randomUUID } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { Pool } from "pg";
|
||||
import { afterAll, beforeAll, beforeEach } from "vitest";
|
||||
|
||||
/** Dedicated schema per suite; never runs application migrations or modifies application rows. */
|
||||
export function testDatabase(): Pool {
|
||||
const connectionString = process.env.EGRESS_TEST_DATABASE_URL ?? "postgres://superposter:superposter_dev@127.0.0.1:5433/superposter";
|
||||
const schema = `egress_test_${randomUUID().replaceAll("-", "")}`;
|
||||
const owner = new Pool({ connectionString });
|
||||
const pool = new Pool({ connectionString, options: `-c search_path=${schema}`, max: 24 });
|
||||
beforeAll(async () => {
|
||||
await owner.query(`CREATE SCHEMA ${schema}`);
|
||||
const client = await pool.connect();
|
||||
try {
|
||||
await client.query("BEGIN");
|
||||
await client.query(await readFile(new URL("../migrations/001_host_budgets.sql", import.meta.url), "utf8"));
|
||||
await client.query("COMMIT");
|
||||
} finally { client.release(); }
|
||||
});
|
||||
beforeEach(async () => { await pool.query("TRUNCATE host_budgets"); });
|
||||
afterAll(async () => {
|
||||
await pool.end();
|
||||
await owner.query(`DROP SCHEMA IF EXISTS ${schema} CASCADE`);
|
||||
await owner.end();
|
||||
});
|
||||
return pool;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue