import test from 'node:test'; import assert from 'node:assert/strict'; import { createRecentIdCache } from '../src/core/recent-id-cache.mjs'; test('recent id cache evicts old ids while retaining duplicate checks for recent ids', () => { const cache = createRecentIdCache({ limit: 2 }); cache.add('quote-1'); cache.add('quote-2'); assert.equal(cache.has('quote-1'), true); cache.add('quote-3'); assert.equal(cache.has('quote-1'), false); assert.equal(cache.has('quote-2'), true); assert.equal(cache.has('quote-3'), true); assert.deepEqual(cache.getState(), { count: 2, limit: 2, evicted_count: 1, }); });