commit 9951150a27479ecd2b49fa44e95aae6ef5c94722
parent c6c578de55b43b2fda1e756324d609cf8659af01
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 18 Nov 2026 16:21:07 -0500
review 1: the capture-refusal test lives with its controller (lib/ may not import controller/)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/common/controller/importPage.instagram.test.ts b/common/controller/importPage.instagram.test.ts
@@ -0,0 +1,26 @@
+// 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"\)/);
+});
diff --git a/common/lib/instagram/visibility.test.ts b/common/lib/instagram/visibility.test.ts
@@ -12,7 +12,6 @@ import {
import { sanitizeSocial } from "../../social/xCookieSource";
import { isSourcelessPostsChannel } from "../sourcelessPosts";
import { anyPostsPlatformPrivate, withheldPostsPlatform } from "../postsVisibility";
-import { xCaptureRefusal } from "../../controller/importPage";
import { isInstagramHostUrl, isInstagramTargetUrl } from "../waybackPages/urls";
const IG = { sourceKind: "social" as const, platform: "instagram" as const };
@@ -102,20 +101,3 @@ test("a Wayback pages channel whose target is on instagram.com follows Instagram
assert.equal(anyPostsPlatformPrivate({}), true, "Instagram is private by default");
assert.equal(anyPostsPlatformPrivate(IG_PUBLIC), false);
});
-
-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"\)/);
-});