Skip to content

Commit dff7a41

Browse files
committed
test(plugin-state): stabilize durable-capacity ordering
1 parent f999d6d commit dff7a41

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/plugin-state/plugin-state-store.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,15 @@ describe("plugin state keyed store", () => {
221221

222222
it("rejects new durable rows at capacity without evicting or blocking updates", async () => {
223223
await withPluginStateTestState(async () => {
224+
vi.useFakeTimers();
224225
const store = createPluginStateKeyedStore<number>("codex", {
225226
namespace: "durable-bindings",
226227
maxEntries: 2,
227228
overflowPolicy: "reject-new",
228229
});
230+
vi.setSystemTime(1000);
229231
await store.register("first", 1);
232+
vi.setSystemTime(2000);
230233
await store.register("second", 2);
231234

232235
await expect(store.register("third", 3)).rejects.toMatchObject({
@@ -236,6 +239,7 @@ describe("plugin state keyed store", () => {
236239
if (!store.update) {
237240
throw new Error("plugin state update unavailable");
238241
}
242+
vi.setSystemTime(3000);
239243
await expect(store.update("first", () => 10)).resolves.toBe(true);
240244
await expect(store.update("third", () => 3)).rejects.toMatchObject({
241245
code: "PLUGIN_STATE_LIMIT_EXCEEDED",

0 commit comments

Comments
 (0)