@open-mercato/cache 0.6.3-develop.3502.1.234f53f93c → 0.6.3-develop.3525.2.cc18b8a43f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -234,6 +234,15 @@ describe('Memory Cache Strategy', () => {
|
|
|
234
234
|
})
|
|
235
235
|
|
|
236
236
|
describe('Statistics', () => {
|
|
237
|
+
beforeEach(() => {
|
|
238
|
+
jest.useFakeTimers()
|
|
239
|
+
jest.setSystemTime(new Date('2025-01-01T00:00:00.000Z'))
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
afterEach(() => {
|
|
243
|
+
jest.useRealTimers()
|
|
244
|
+
})
|
|
245
|
+
|
|
237
246
|
it('should return correct statistics', async () => {
|
|
238
247
|
await cache.set('key1', 'value1')
|
|
239
248
|
await cache.set('key2', 'value2')
|
|
@@ -243,7 +252,7 @@ describe('Memory Cache Strategy', () => {
|
|
|
243
252
|
expect(stats.size).toBe(3)
|
|
244
253
|
expect(stats.expired).toBe(0)
|
|
245
254
|
|
|
246
|
-
await
|
|
255
|
+
await jest.advanceTimersByTimeAsync(100)
|
|
247
256
|
|
|
248
257
|
stats = await cache.stats()
|
|
249
258
|
expect(stats.size).toBe(3)
|