// A capture of an instagram.com page goes into no PUBLIC pages channel while // Instagram posts are private (review 1, S12): import-page's one refusal, // asked for Instagram as it is for X. X's answers are pinned. import { test } from "node:test"; import assert from "node:assert/strict"; import { xCaptureRefusal } from "./importPage"; const IG_PUBLIC = { social: { instagram: { visibility: "public" } } }; const PAGES = (url: string) => ({ sourceKind: "social" as const, platform: "webpage" as const, wayback: { targets: [{ url }] } }); test("a capture of an instagram.com page goes into no public pages channel while Instagram is private; X's refusal is what it was", () => { const url = "https://www.instagram.com/example.account/"; const other = PAGES("example.com/blog") as never; const igPages = PAGES("instagram.com/example.account") as never; assert.match( xCaptureRefusal(other, "some-pages", url, {}) ?? "", /is on Instagram, whose posts are private here \(social\.instagram\.visibility is not "public"\); import an Instagram capture into a Wayback pages channel whose target is on instagram\.com, which a public site leaves out — not into some-pages/, ); assert.equal(xCaptureRefusal(igPages, "ig-pages", url, {}), null); assert.equal(xCaptureRefusal(other, "some-pages", url, IG_PUBLIC), null); assert.equal(xCaptureRefusal(other, "some-pages", "https://example.com/a", {}), null); // X: refused only while X is private, with X's own sentence. const xUrl = "https://x.com/example/status/1"; assert.equal(xCaptureRefusal(other, "some-pages", xUrl, {}), null); assert.match(xCaptureRefusal(other, "some-pages", xUrl, { social: { x: { visibility: "private" } } }) ?? "", /is on X, whose posts are private here \(social\.x\.visibility "private"\)/); });