feat: merge market core user id flow
This commit is contained in:
@@ -16,14 +16,19 @@ describe("batch-payload", () => {
|
||||
batchName: "618达人筛选第一批",
|
||||
createdAt: "2026-04-22T12:30:00.000Z",
|
||||
records: [
|
||||
{ authorId: "111", authorName: "达人A", status: "success" },
|
||||
{
|
||||
authorId: "111",
|
||||
authorName: "达人A",
|
||||
coreUserId: "core-111",
|
||||
status: "success"
|
||||
},
|
||||
{ authorId: "222", authorName: "达人B", status: "success" }
|
||||
]
|
||||
});
|
||||
|
||||
expect(payload).toEqual({
|
||||
authors: [
|
||||
{ authorId: "111", authorName: "达人A" },
|
||||
{ authorId: "111", authorName: "达人A", authorUid: "core-111" },
|
||||
{ authorId: "222", authorName: "达人B" }
|
||||
],
|
||||
batchName: "618达人筛选第一批",
|
||||
|
||||
@@ -126,4 +126,42 @@ describe("market-page-bridge", () => {
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
test("serializes core user ids from the live market list", async () => {
|
||||
const marketRoot = document.querySelector(".base-author-list") as HTMLElement & {
|
||||
__vue__?: {
|
||||
_setupState?: Record<string, unknown>;
|
||||
};
|
||||
};
|
||||
marketRoot.__vue__ = {
|
||||
_setupState: {
|
||||
marketState: {
|
||||
marketList: [
|
||||
{
|
||||
attribute_datas: {
|
||||
avg_search_after_view_rate_30d: "0.1234",
|
||||
core_user_id: "core-111",
|
||||
nickname: "搜索达人"
|
||||
},
|
||||
star_id: "search-1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await import("../src/content/market/page-bridge");
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
document.documentElement.getAttribute("data-sces-market-rows") ?? "[]"
|
||||
)
|
||||
).toEqual([
|
||||
expect.objectContaining({
|
||||
authorId: "search-1",
|
||||
authorName: "搜索达人",
|
||||
coreUserId: "core-111"
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,6 +50,7 @@ describe("silent-export-controller", () => {
|
||||
authors: [
|
||||
{
|
||||
attribute_datas: {
|
||||
core_user_id: `core-${pageNo}`,
|
||||
nickname: `达人${pageNo}`,
|
||||
price_20_60: pageNo * 1000
|
||||
},
|
||||
@@ -93,6 +94,10 @@ describe("silent-export-controller", () => {
|
||||
}
|
||||
]);
|
||||
expect(records?.map((record) => record.authorId)).toEqual(["2", "3"]);
|
||||
expect(records?.map((record) => record.coreUserId)).toEqual([
|
||||
"core-2",
|
||||
"core-3"
|
||||
]);
|
||||
});
|
||||
|
||||
test("replays paged exports when the page number is nested inside the request body", async () => {
|
||||
|
||||
Reference in New Issue
Block a user