mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-30 05:39:47 +08:00
feat(baoyu-fetch): add URL reader CLI with Chrome CDP and site adapters
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { resolveAdapter } from "../adapters";
|
||||
|
||||
describe("adapter registry", () => {
|
||||
test("matches x adapter for x.com status URLs", () => {
|
||||
const adapter = resolveAdapter({
|
||||
url: new URL("https://x.com/openai/status/1234567890"),
|
||||
});
|
||||
expect(adapter.name).toBe("x");
|
||||
});
|
||||
|
||||
test("matches hn adapter for item URLs", () => {
|
||||
const adapter = resolveAdapter({
|
||||
url: new URL("https://news.ycombinator.com/item?id=47534848"),
|
||||
});
|
||||
expect(adapter.name).toBe("hn");
|
||||
});
|
||||
|
||||
test("falls back to generic adapter", () => {
|
||||
const adapter = resolveAdapter({
|
||||
url: new URL("https://example.com/post"),
|
||||
});
|
||||
expect(adapter.name).toBe("generic");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user