test: reconcile legacy analytics count fields as zero
This commit is contained in:
@@ -59,7 +59,7 @@ try {
|
|||||||
const auditPath = `/caller-analytics/overview?customerId=${fixture}&view=landing&from=${encodeURIComponent(auditFrom)}`;
|
const auditPath = `/caller-analytics/overview?customerId=${fixture}&view=landing&from=${encodeURIComponent(auditFrom)}`;
|
||||||
const beforeReplay = await get(auditPath); assert.equal(beforeReplay.status,200);
|
const beforeReplay = await get(auditPath); assert.equal(beforeReplay.status,200);
|
||||||
const stateRows = await db.$queryRaw`SELECT counts FROM caller_analysis_states WHERE customer_id=${fixture} AND view='landing' AND started_at>=${new Date(auditFrom)}`;
|
const stateRows = await db.$queryRaw`SELECT counts FROM caller_analysis_states WHERE customer_id=${fixture} AND view='landing' AND started_at>=${new Date(auditFrom)}`;
|
||||||
for (const key of COUNT_KEYS) assert.equal(beforeReplay.body.summary[key],stateRows.reduce((sum,row)=>sum+row.counts[key],0),`Minute bucket reconciliation: ${key}`);
|
for (const key of COUNT_KEYS) assert.equal(beforeReplay.body.summary[key],stateRows.reduce((sum,row)=>sum+Number(row.counts[key]??0),0),`Minute bucket reconciliation: ${key}`);
|
||||||
const events = await db.$queryRaw`SELECT payload FROM caller_analysis_events WHERE call_key=${detail.body.rows[0].callKey}`;
|
const events = await db.$queryRaw`SELECT payload FROM caller_analysis_events WHERE call_key=${detail.body.rows[0].callKey}`;
|
||||||
const store = new CallerAnalyticsStore(db);
|
const store = new CallerAnalyticsStore(db);
|
||||||
for (const event of events) assert.equal(await store.consume(event.payload),'duplicate');
|
for (const event of events) assert.equal(await store.consume(event.payload),'duplicate');
|
||||||
|
|||||||
Reference in New Issue
Block a user