feat: export author spread metrics

This commit is contained in:
wxs
2026-06-29 16:06:14 +08:00
parent 7839380613
commit 121977fd0d
14 changed files with 1117 additions and 20 deletions
+43
View File
@@ -155,6 +155,49 @@ describe("silent-export-controller", () => {
expect(records?.map((record) => record.authorId)).toEqual(["2", "3"]);
});
test("keeps attribute_datas.id as the spread author id while preserving star_id as row id", async () => {
document.documentElement.setAttribute(
"data-sces-market-request-snapshot",
JSON.stringify({
body: JSON.stringify({
page_param: {
page: 1
}
}),
method: "POST",
url: "https://xingtu.cn/api/mock-market-search"
})
);
const controller = createSilentExportController({
document,
fetchImpl: async () => ({
json: async () => ({
authors: [
{
attribute_datas: {
id: "spread-1",
nickname: "达人1"
},
star_id: "row-1"
}
]
}),
ok: true
})
});
const records = await controller.exportRecords({
mode: "count",
pageCount: 1
});
expect(records?.[0]).toMatchObject({
authorId: "row-1",
spreadAuthorId: "spread-1"
});
});
test("starts from page 1 when the captured request omits an explicit page number", async () => {
document.documentElement.setAttribute(
"data-sces-market-request-snapshot",