From ea4cb96b23639be29f08b472171c1ae9a1613445 Mon Sep 17 00:00:00 2001 From: Theo Date: Sun, 5 Jan 2025 09:05:54 +0800 Subject: [PATCH] chore: add fs system cache update test in cache.js --- packages/rss-libs/test/middleware/cache.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/rss-libs/test/middleware/cache.js b/packages/rss-libs/test/middleware/cache.js index 35e40eded0ad64..67a9286b49561f 100644 --- a/packages/rss-libs/test/middleware/cache.js +++ b/packages/rss-libs/test/middleware/cache.js @@ -29,6 +29,18 @@ describe("cache test suite", () => { expect(await cache.get(key)).toBeNull(); }); + it("should support fs system cache (update)", async () => { + const cache = new FileSystemCache(); + await cache.syncReady(); + const key = uuid.v4(); + const v1 = uuid.v4(); + await cache.set(key, v1, 0.5); + expect(await cache.get(key)).toBe(v1); + await cache.set(key, v1 + "2", 0.5); + expect(await cache.get(key)).toBe(v1 + "2"); + }); + + if (process.env.REDIS_URL !== undefined) { it("should support redis cache", async () => { const client = new RedisCache();