test: simplify bootstrap cache hit count

This commit is contained in:
Peter Steinberger
2026-05-08 23:01:35 +01:00
parent df1851b27d
commit 4fb3bd845f

View File

@@ -475,7 +475,12 @@ describe("bootstrap prompt warnings", () => {
injectLegacyWarning(optimizedTurns[2] ?? "", warningLines),
];
const cacheHitRate = (turns: string[]) => {
const hits = turns.slice(1).filter((turn, index) => turn === turns[index]).length;
let hits = 0;
for (let index = 1; index < turns.length; index++) {
if (turns[index] === turns[index - 1]) {
hits++;
}
}
return hits / Math.max(1, turns.length - 1);
};