- 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]>
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { createMockFetch, YEMA_USER_BASIC, YEMA_USER_ERROR } from "@umt/testkit";
|
|
import { describe, expect, it } from "vitest";
|
|
import { runParser } from "./testing.ts";
|
|
import { YemaSiteUserInfo } from "./yema.ts";
|
|
|
|
const URL_ = "https://www.yemapt.org/openApi/user/fetchBasicInfo.json";
|
|
|
|
describe("YemaSiteUserInfo(MP yema.py)", () => {
|
|
it("POST fetchBasicInfo(JSON 体,Authorization=AuthKey):促销流量为上传/下载", async () => {
|
|
const m = createMockFetch({ [`POST ${URL_}`]: { body: YEMA_USER_BASIC } });
|
|
const info = await runParser(YemaSiteUserInfo, { fetch: m.fetch, url: "https://www.yemapt.org/", apikey: "ak" });
|
|
expect(info).toMatchObject({
|
|
schema: "Yema",
|
|
userId: "321",
|
|
username: "leo",
|
|
userLevel: "3",
|
|
joinAt: "2024-05-06 07:08:09",
|
|
upload: 3000,
|
|
download: 1000,
|
|
ratio: 3,
|
|
bonus: 12.3,
|
|
});
|
|
const req = m.requests[0]!;
|
|
expect(req.headers.authorization).toBe("ak");
|
|
expect(req.headers["content-type"]).toBe("application/json");
|
|
expect(req.body).toBe("{}");
|
|
});
|
|
|
|
it("success=false:errMsg 为 errorMessage", async () => {
|
|
const m = createMockFetch({ [`POST ${URL_}`]: { body: YEMA_USER_ERROR } });
|
|
const info = await runParser(YemaSiteUserInfo, { fetch: m.fetch, url: "https://www.yemapt.org/", apikey: "x" });
|
|
expect(info.userId).toBeNull();
|
|
expect(info.errMsg).toBe("AuthKey 无效");
|
|
});
|
|
});
|