fix: derive missing A3 batch metrics

This commit is contained in:
2026-04-23 17:41:33 +08:00
parent fb45f0cea8
commit b3bcc2af45
2 changed files with 121 additions and 2 deletions
+34
View File
@@ -63,6 +63,40 @@ describe("backend-metrics-client", () => {
]);
});
test("derives A3 count and CPA3 from the live aggregate response shape", () => {
expect(
mapBackendMetricsSearchResponse({
data: {
data: [
{
avg_after_view_search_cnt: 25982,
avg_after_view_search_rate: 0.0010872130261527625,
avg_new_a3_rate: 0.11075860229946684,
cp_search: 21.168501270110077,
cpe: 0.630604497471276,
cpm: 23.014670324994974,
star_id: "7021245050621263906",
total_estimated_video_cost: 1100000,
total_play_cnt: 47795601,
video_count: 2
}
]
},
success: true
})
).toEqual([
{
a3IncreaseCount: "2,646,886.98",
afterViewSearchCount: "25,982.00",
afterViewSearchRate: "0.11%",
cpSearch: "21.17",
cpa3: "0.21",
newA3Rate: "11.08%",
starId: "7021245050621263906"
}
]);
});
test("posts star ids with bearer auth when searching backend metrics", async () => {
const fetchImpl = async (_input: string, init?: RequestInit) => ({
json: async () => ({