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/.
33 lines
1.7 KiB
JavaScript
33 lines
1.7 KiB
JavaScript
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const fs = require("node:fs");
|
|
const Module = require("node:module");
|
|
const ts = require("typescript");
|
|
function load(file) {
|
|
const source = fs.readFileSync(file, "utf8");
|
|
const compiled = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 } }).outputText;
|
|
const loaded = new Module(file, module);
|
|
loaded._compile(compiled, file);
|
|
return loaded.exports;
|
|
}
|
|
const { swipeIntent, swipeResult } = load("src/lib/gestures.ts");
|
|
const { nativeAmplifyActions } = load("src/lib/amplify.ts");
|
|
const { PLATFORMS } = load("src/lib/platforms.ts");
|
|
|
|
test("vertical scroll never locks to horizontal reveal", () => {
|
|
for (const [dx, dy] of [[0, 12], [9, 20], [-20, 60], [15, 50], [-40, 120]]) assert.equal(swipeIntent(dx, dy), "vertical");
|
|
});
|
|
test("small motion remains pending and deliberate horizontal motion reveals", () => {
|
|
assert.equal(swipeIntent(6, 3), "pending");
|
|
assert.equal(swipeIntent(-40, 10), "horizontal");
|
|
assert.equal(swipeResult(-50, 0.2, "left"), "closed");
|
|
assert.equal(swipeResult(-90, 0.2, "left"), "open");
|
|
assert.equal(swipeResult(-180, 0.2, "left"), "full");
|
|
});
|
|
test("native amplify labels follow platform capabilities", () => {
|
|
assert.deepEqual(nativeAmplifyActions(PLATFORMS.mastodon).map((item) => item.label), ["Boost", "Quote"]);
|
|
assert.deepEqual(nativeAmplifyActions(PLATFORMS.telegram).map((item) => item.label), ["Forward"]);
|
|
assert.deepEqual(nativeAmplifyActions(PLATFORMS.facebook).map((item) => item.label), ["Share link"]);
|
|
assert.deepEqual(nativeAmplifyActions(PLATFORMS.instagram), []);
|
|
assert.deepEqual(nativeAmplifyActions(PLATFORMS.limited), []);
|
|
});
|