diff --git a/services/platform-service/src/modules/products/cache.test.ts b/services/platform-service/src/modules/products/cache.test.ts index d16b7264..b19a70e7 100644 --- a/services/platform-service/src/modules/products/cache.test.ts +++ b/services/platform-service/src/modules/products/cache.test.ts @@ -9,7 +9,13 @@ vi.mock('./repository.js', () => ({ })); import { getAll } from './repository.js'; -import { loadProductCache, getProduct, isValidProduct, getAllProducts, cacheSize } from './cache.js'; +import { + loadProductCache, + getProduct, + isValidProduct, + getAllProducts, + cacheSize, +} from './cache.js'; const mockGetAll = vi.mocked(getAll); @@ -97,13 +103,19 @@ describe('product cache', () => { }); describe('getAllProducts', () => { - it('returns all cached products', async () => { + it('returns all cached products (plus temporary fallback products)', async () => { mockGetAll.mockResolvedValue(products); await loadProductCache(); const all = getAllProducts(); - expect(all).toHaveLength(2); + // The cache holds 2 products (lysnrai, mindlyst) and getAllProducts() + // additionally injects entries from TEMPORARY_FALLBACK_PRODUCTS that + // are not already in the cache. Today that set is { invttrdg }, so + // the total is 3. When the invttrdg fallback is removed (see + // cache.ts TODO), this expectation should drop back to 2. + expect(all).toHaveLength(3); expect(all.map(p => p.id)).toContain('lysnrai'); expect(all.map(p => p.id)).toContain('mindlyst'); + expect(all.map(p => p.id)).toContain('invttrdg'); }); });