Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,6 +1,12 @@
import { afterEach, describe, expect, test, vi } from "vitest";
import { __resetSharedStoreForTests, __setSharedStoreFactoryForTests, getSharedStore } from "./shared-store.server";
import {
__resetSharedStoreForTests,
__setSharedStoreFactoryForTests,
closeSharedStores,
getCrossAppCacheStore,
getSharedStore,
} from "./shared-store.server";
afterEach(() => {
__resetSharedStoreForTests();
@@ -49,4 +55,46 @@ describe("web shared-store singleton", () => {
if (originalRedisUrl !== undefined) process.env.REDIS_URL = originalRedisUrl;
}
});
test("binds cross-app cache traffic to the shared namespace and adapter", () => {
const local = getSharedStore();
const crossApp = getCrossAppCacheStore();
expect(crossApp.namespace).toBe("cross-app-cache");
expect(crossApp.adapter).toBe(local.adapter);
expect(getCrossAppCacheStore()).toBe(crossApp);
});
test("closes a shared adapter once and clears both singleton stores", async () => {
const close = vi.fn(async () => undefined);
const adapter = { close } as never;
const factory = vi.fn(() => ({
namespace: "web",
ttlDefault: undefined,
adapter,
key: (suffix: string) => suffix,
get: async () => null,
set: async () => true,
del: async () => 0,
incr: async () => 0,
expire: async () => true,
mget: async () => [],
scan: async function* () {},
publish: async () => 0,
subscribe: async () => async () => undefined,
zAdd: async () => 0,
zRemRangeByScore: async () => 0,
zCard: async () => 0,
eval: async () => null,
close,
}));
__setSharedStoreFactoryForTests(factory);
getSharedStore();
getCrossAppCacheStore();
await closeSharedStores();
expect(close).toHaveBeenCalledTimes(1);
getSharedStore();
expect(factory).toHaveBeenCalledTimes(2);
});
});