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
59
packages/connector-mock-social/src/contract.test.ts
Normal file
59
packages/connector-mock-social/src/contract.test.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { createMockSocialConnector, createMockSocialState } from "./index.js";
|
||||
import { connectorContractTests } from "@tactical-media-broadcast-hub/connector-sdk/testing";
|
||||
import type { ConnectorConnection } from "@tactical-media-broadcast-hub/core";
|
||||
|
||||
const connection: ConnectorConnection = {
|
||||
id: "conn-social",
|
||||
workspaceId: "ws-1",
|
||||
provider: "mock-social",
|
||||
channelId: "ch-1",
|
||||
credentialId: { kind: "credential-ref", id: "cred-1" },
|
||||
fields: {},
|
||||
createdAt: new Date(),
|
||||
};
|
||||
|
||||
connectorContractTests(createMockSocialConnector(createMockSocialState()), { connection });
|
||||
|
||||
describe("mock-social behavior", () => {
|
||||
it("publish then feed shows the post, delete removes it", async () => {
|
||||
const state = createMockSocialState();
|
||||
const connector = createMockSocialConnector(state);
|
||||
const pub = await connector.publish?.(connection, {
|
||||
text: "hello world",
|
||||
mediaAssetIds: [],
|
||||
visibility: "public",
|
||||
providerMetadata: {},
|
||||
});
|
||||
expect(pub?.remoteId).toBeTruthy();
|
||||
const feed = await connector.getFeed?.(connection, { kind: "home", limit: 10 });
|
||||
expect(feed?.items[0]?.text).toBe("hello world");
|
||||
await connector.deletePublication?.(connection, pub!.remoteId);
|
||||
const after = await connector.getFeed?.(connection, { kind: "home", limit: 10 });
|
||||
expect(after?.items.some((i) => i.remoteId === pub?.remoteId)).toBe(false);
|
||||
});
|
||||
|
||||
it("amplify repost and quote create new feed items referencing the target", async () => {
|
||||
const state = createMockSocialState();
|
||||
const connector = createMockSocialConnector(state);
|
||||
const pub = await connector.publish?.(connection, {
|
||||
text: "original",
|
||||
mediaAssetIds: [],
|
||||
visibility: "public",
|
||||
providerMetadata: {},
|
||||
});
|
||||
const repost = await connector.amplify?.(connection, {
|
||||
kind: "repost",
|
||||
targetRemoteId: pub!.remoteId,
|
||||
});
|
||||
expect(repost?.providerMetadata).toMatchObject({ amplifies: pub!.remoteId, kind: "repost" });
|
||||
const quote = await connector.amplify?.(connection, {
|
||||
kind: "quote",
|
||||
targetRemoteId: pub!.remoteId,
|
||||
commentary: "important",
|
||||
});
|
||||
const feed = await connector.getFeed?.(connection, { kind: "home", limit: 10 });
|
||||
expect(feed?.items[0]?.text).toContain("important ↻ original");
|
||||
expect(quote).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue