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/.
59 lines
2.3 KiB
TypeScript
59 lines
2.3 KiB
TypeScript
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();
|
|
});
|
|
});
|