Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/bundlecheck/src/__tests__/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ describe("clearCache", () => {
});

describe("cache eviction", () => {
it("should enforce maximum of 100 entries", () => {
it("should enforce maximum of 1000 entries", () => {
const mockResult: BundleResult = {
packageName: "test",
packageVersion: "1.0.0",
Expand All @@ -463,8 +463,8 @@ describe("cache eviction", () => {
platform: "browser",
};

// Add 105 entries
for (let i = 0; i < 105; i++) {
// Add 1005 entries
for (let i = 0; i < 1005; i++) {
const key = normalizeCacheKey({
packageName: `package-${i}`,
version: "1.0.0",
Expand All @@ -477,8 +477,8 @@ describe("cache eviction", () => {
setCachedResult(key, { ...mockResult, packageName: `package-${i}` });
}

// Should have at most 100 entries
expect(getCacheCount()).toBe(100);
// Should have at most 1000 entries
expect(getCacheCount()).toBe(1000);
});

it("should evict oldest entries first (FIFO)", () => {
Expand All @@ -494,8 +494,8 @@ describe("cache eviction", () => {
platform: "browser",
};

// Add 105 entries
for (let i = 0; i < 105; i++) {
// Add 1005 entries
for (let i = 0; i < 1005; i++) {
const key = normalizeCacheKey({
packageName: `package-${i}`,
version: "1.0.0",
Expand All @@ -522,8 +522,8 @@ describe("cache eviction", () => {
expect(getCachedResult(key)).toBeNull();
}

// Entries 5-104 should still exist
for (let i = 5; i < 105; i++) {
// Entries 5-1004 should still exist
for (let i = 5; i < 1005; i++) {
const key = normalizeCacheKey({
packageName: `package-${i}`,
version: "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundlecheck/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from "node:path";
import Database from "better-sqlite3";
import type { BundleResult } from "./bundler.js";

const MAX_CACHE_ENTRIES = 100;
const MAX_CACHE_ENTRIES = 1000;

/**
* Get the cache directory path (computed lazily to support testing).
Expand Down