Files
oh-my-opencode/src/plugin/recent-synthetic-idles.test.ts
T

25 lines
613 B
TypeScript
Raw Normal View History

2026-02-10 14:08:02 +09:00
import { describe, it, expect } from "bun:test"
import { pruneRecentSyntheticIdles } from "./recent-synthetic-idles"
describe("pruneRecentSyntheticIdles", () => {
it("removes entries older than dedup window", () => {
//#given
2026-02-10 14:08:02 +09:00
const recentSyntheticIdles = new Map<string, number>([
["ses_old", 1000],
["ses_new", 1600],
])
//#when
2026-02-10 14:08:02 +09:00
pruneRecentSyntheticIdles({
recentSyntheticIdles,
now: 2000,
dedupWindowMs: 500,
})
//#then
2026-02-10 14:08:02 +09:00
expect(recentSyntheticIdles.has("ses_old")).toBe(false)
expect(recentSyntheticIdles.has("ses_new")).toBe(true)
})
})