mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-30 06:12:06 -07:00
Fix monthly rollup test expectations
- Preserve multi-arg Date construction in mock helper - Align rollup assertions with the correct videoId
This commit is contained in:
@@ -90,7 +90,7 @@ function withMockDate<T>(fixedDate: Date, run: (realDate: typeof Date) => T): T
|
|||||||
if (args.length === 0) {
|
if (args.length === 0) {
|
||||||
super(fixedDateMs);
|
super(fixedDateMs);
|
||||||
} else {
|
} else {
|
||||||
super(args[0]);
|
super(...(args as [any?, any?, any?, any?, any?, any?, any?]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1516,11 +1516,11 @@ test('getMonthlyRollups derives rate metrics from stored monthly totals', () =>
|
|||||||
const rows = getMonthlyRollups(db, 1);
|
const rows = getMonthlyRollups(db, 1);
|
||||||
assert.equal(rows.length, 2);
|
assert.equal(rows.length, 2);
|
||||||
const rowsByVideoId = new Map(rows.map((row) => [row.videoId, row]));
|
const rowsByVideoId = new Map(rows.map((row) => [row.videoId, row]));
|
||||||
assert.equal(rowsByVideoId.get(2)?.cardsPerHour, 30);
|
assert.equal(rowsByVideoId.get(1)?.cardsPerHour, 30);
|
||||||
assert.equal(rowsByVideoId.get(2)?.tokensPerMin, 3);
|
assert.equal(rowsByVideoId.get(1)?.tokensPerMin, 3);
|
||||||
assert.equal(rowsByVideoId.get(2)?.lookupHitRate ?? null, null);
|
assert.equal(rowsByVideoId.get(1)?.lookupHitRate ?? null, null);
|
||||||
assert.equal(rowsByVideoId.get(1)?.cardsPerHour ?? null, null);
|
assert.equal(rowsByVideoId.get(2)?.cardsPerHour ?? null, null);
|
||||||
assert.equal(rowsByVideoId.get(1)?.tokensPerMin ?? null, null);
|
assert.equal(rowsByVideoId.get(2)?.tokensPerMin ?? null, null);
|
||||||
} finally {
|
} finally {
|
||||||
db.close();
|
db.close();
|
||||||
cleanupDbPath(dbPath);
|
cleanupDbPath(dbPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user