release: 0.2.0421.2

This commit is contained in:
2026-04-21 17:10:06 +08:00
parent 55324a5bb7
commit 968cc88c62
19 changed files with 2832 additions and 178 deletions
+30 -4
View File
@@ -4,7 +4,7 @@ import { buildMarketCsv } from "../src/content/market/csv-exporter";
import type { MarketRecord } from "../src/content/market/types";
describe("csv-exporter", () => {
test("uses the expected header order", () => {
test("uses fallback header order when no page export fields are available", () => {
const csv = buildMarketCsv([]);
const [headerLine] = csv.split("\n");
@@ -15,12 +15,38 @@ describe("csv-exporter", () => {
"地区",
"21-60s报价",
"单视频看后搜率",
"个人视频看后搜率",
"插件数据状态"
"个人视频看后搜率"
].join(",")
);
});
test("uses page export field order and appends the two plugin columns", () => {
const csv = buildMarketCsv([
{
authorId: "123",
authorName: "Alice",
exportFields: {
: "Alice",
: "100w",
"21-60s报价": "¥450,000"
},
status: "success",
rates: {
singleVideoAfterSearchRate: "0.5%-1%",
personalVideoAfterSearchRate: "1% - 3%"
}
} satisfies MarketRecord
]);
const [headerLine, rowLine] = csv.split("\n");
expect(headerLine).toBe(
["达人信息", "粉丝数", "21-60s报价", "单视频看后搜率", "个人视频看后搜率"].join(
","
)
);
expect(rowLine).toBe('Alice,100w,"¥450,000",0.5% - 1%,1% - 3%');
});
test("escapes commas and quotes", () => {
const csv = buildMarketCsv([
{
@@ -51,7 +77,7 @@ describe("csv-exporter", () => {
]);
const [, rowLine] = csv.split("\n");
expect(rowLine).toBe("123,Alice,,,,,failed");
expect(rowLine).toBe("123,Alice,,,,");
});
test("uses normalized display values in export rows", () => {