fix: respect selected audience export fields
This commit is contained in:
@@ -201,13 +201,37 @@ describe("audience-profile-csv", () => {
|
||||
const [headerLine, rowLine] = csv.split("\n");
|
||||
|
||||
expect(headerLine).toBe(
|
||||
"达人信息,连接用户数,内容数据-个人视频-近30天-播放量中位数,观众画像-男性占比"
|
||||
"达人ID,达人名称,导出状态,失败原因,内容数据-个人视频-近30天-播放量中位数,观众画像-男性占比"
|
||||
);
|
||||
expect(rowLine).toBe("达人 A,300w,10913233,71.7%");
|
||||
expect(rowLine).toBe("123,达人 A,成功,,10913233,71.7%");
|
||||
expect(headerLine).not.toContain("秒思api-看后搜数");
|
||||
expect(headerLine).not.toContain("粉丝画像-女性占比");
|
||||
});
|
||||
|
||||
test("omits unselected market-list columns after field settings are saved", () => {
|
||||
const row = buildSuccessRow({
|
||||
exportFields: {
|
||||
达人信息: "达人 A",
|
||||
粉丝数: "300w",
|
||||
预期CPM: "120"
|
||||
}
|
||||
});
|
||||
|
||||
const csv = buildAudienceProfileCsv([row], {
|
||||
selectedHeaders: ["内容数据-个人视频-近30天-播放量中位数"]
|
||||
});
|
||||
|
||||
const [headerLine, rowLine] = csv.split("\n");
|
||||
|
||||
expect(headerLine).toBe(
|
||||
"达人ID,达人名称,导出状态,失败原因,内容数据-个人视频-近30天-播放量中位数"
|
||||
);
|
||||
expect(rowLine).toBe("123,达人 A,成功,,10913233");
|
||||
expect(headerLine).not.toContain("达人信息");
|
||||
expect(headerLine).not.toContain("粉丝数");
|
||||
expect(headerLine).not.toContain("预期CPM");
|
||||
});
|
||||
|
||||
test("always keeps fixed id export headers when filtering", () => {
|
||||
const row = buildSuccessRow({
|
||||
exportFields: {
|
||||
@@ -267,6 +291,19 @@ describe("audience-profile-csv", () => {
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test("includes current market-list columns in the field picker", () => {
|
||||
expect(
|
||||
listAudienceProfileSelectableFieldGroups(["达人信息", "粉丝数"])
|
||||
).toEqual(
|
||||
expect.arrayContaining([
|
||||
{
|
||||
headers: ["达人信息", "粉丝数"],
|
||||
label: "列表字段"
|
||||
}
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function readCsvValue(csv: string, header: string): string {
|
||||
|
||||
Reference in New Issue
Block a user