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
36
packages/connector-slack/src/contract.test.ts
Normal file
36
packages/connector-slack/src/contract.test.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import type { ConnectorConnection } from "@tactical-media-broadcast-hub/core";
|
||||
import { connectorContractTests } from "@tactical-media-broadcast-hub/connector-sdk/testing";
|
||||
import { createSlackConnector } from "./index.js";
|
||||
|
||||
const connection: ConnectorConnection = {
|
||||
id: "conn-slack",
|
||||
workspaceId: "ws-1",
|
||||
provider: "slack",
|
||||
channelId: "C0123456789",
|
||||
credentialId: { kind: "credential-ref", id: "cred-slack" },
|
||||
fields: {
|
||||
botToken: "xoxb-test-token",
|
||||
teamId: "T0123456789",
|
||||
},
|
||||
createdAt: new Date(),
|
||||
};
|
||||
|
||||
const fetchImpl: typeof fetch = async (input, init): Promise<Response> => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
||||
if (url === "https://slack.com/api/auth.test") {
|
||||
if (new Headers(init?.headers).get("authorization") !== "Bearer xoxb-test-token") {
|
||||
return new Response(JSON.stringify({ ok: false, error: "invalid_auth" }));
|
||||
}
|
||||
return new Response(JSON.stringify({
|
||||
ok: true,
|
||||
team: "AnarchoPoster",
|
||||
team_id: "T0123456789",
|
||||
user: "anarchoposter",
|
||||
user_id: "U0123456789",
|
||||
bot_id: "B0123456789",
|
||||
}));
|
||||
}
|
||||
return new Response(JSON.stringify({ ok: false, error: `unexpected request: ${url}` }));
|
||||
};
|
||||
|
||||
connectorContractTests(createSlackConnector({ fetchImpl }), { connection });
|
||||
Loading…
Add table
Add a link
Reference in a new issue