feat(baoyu-fetch): add URL reader CLI with Chrome CDP and site adapters

This commit is contained in:
Jim Liu 宝玉
2026-03-27 14:11:00 -05:00
parent 2c14872e88
commit d0764c2739
65 changed files with 10235 additions and 0 deletions
@@ -0,0 +1,55 @@
import { describe, expect, test } from "bun:test";
import { shouldAutoContinueForceWait } from "../commands/convert";
describe("shouldAutoContinueForceWait", () => {
test("continues when a challenge disappears", () => {
expect(
shouldAutoContinueForceWait(
{
url: "https://example.com/challenge",
hasGate: true,
loginState: "unknown",
},
{
url: "https://example.com/article",
hasGate: false,
loginState: "unknown",
},
),
).toBe(true);
});
test("continues when login state improves from logged out", () => {
expect(
shouldAutoContinueForceWait(
{
url: "https://x.com/i/flow/login",
hasGate: false,
loginState: "logged_out",
},
{
url: "https://x.com/home",
hasGate: false,
loginState: "logged_in",
},
),
).toBe(true);
});
test("does not continue when nothing changed yet", () => {
expect(
shouldAutoContinueForceWait(
{
url: "https://x.com/lennysan/status/2036483059407810640",
hasGate: false,
loginState: "unknown",
},
{
url: "https://x.com/lennysan/status/2036483059407810640",
hasGate: false,
loginState: "unknown",
},
),
).toBe(false);
});
});