- sites/spiders: Haidan/HDDolby/RousiPro/SunnyPT/TNode/TorrentLeech/Yema (+mTorrent wrapper), specialized SiteAdapter, indirect download resolved at download time - sites/user-parsers: SiteParserBase + all 20 MP SiteSchema parsers (lxml XPath via xpath+xmldom), refreshSiteUserData with schema fallback - sites/definitions: zod SiteDefinition schemas, 23 MovieClaw v0.27.0 (MIT) definitions via scripts/mp-sync/movieclaw-import.mjs, registry getSiteDefinition/listSiteDefinitions, NOTICE - scripts/mp-sync: ledger.json (upstream sha256), check.mjs, build-ledger.mjs; docs/porting/mp-sync-ledger.md - license-and-provenance: add copied-mit kind, re-anchor MovieClaw rows to v0.27.0 Co-Authored-By: Claude Opus 5.5 <[email protected]>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { createMockFetch, DISCUZ_USER_INDEX, DISCUZ_USER_SEEDING, DISCUZ_USER_SPACE } from "@umt/testkit";
|
|
import { describe, expect, it } from "vitest";
|
|
import { DiscuzUserInfo } from "./discuz.ts";
|
|
import { runParser } from "./testing.ts";
|
|
|
|
describe("DiscuzUserInfo(MP discuz.py)", () => {
|
|
it("&uid= 链接定位用户,空间页取等级/积分/流量,做种表按表头定位列", async () => {
|
|
const m = createMockFetch({
|
|
"/": { body: DISCUZ_USER_INDEX },
|
|
"/home.php?uid=42": { body: DISCUZ_USER_SPACE },
|
|
"/forum.php?mod=torrents": { body: DISCUZ_USER_SEEDING },
|
|
});
|
|
const info = await runParser(DiscuzUserInfo, { fetch: m.fetch });
|
|
expect(info).toMatchObject({
|
|
schema: "DiscuzX",
|
|
userId: "42",
|
|
username: "frank",
|
|
userLevel: "Lv3",
|
|
joinAt: "2018-02-03 04:05:00",
|
|
bonus: 520,
|
|
upload: 2 * 1024 ** 4,
|
|
download: 500 * 1024 ** 3,
|
|
seeding: 1,
|
|
seedingInfo: [[6, 8 * 1024 ** 3]],
|
|
});
|
|
});
|
|
|
|
it("未登录(无登出链接):errMsg", async () => {
|
|
const m = createMockFetch({
|
|
"/": { body: "<html><body><a href='member.php?mod=logging&action=login'>登录</a></body></html>" },
|
|
});
|
|
const info = await runParser(DiscuzUserInfo, { fetch: m.fetch });
|
|
expect(info.errMsg).toContain("未检测到已登陆");
|
|
expect(info.userId).toBeNull();
|
|
});
|
|
});
|