40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const cacheBootstrap = vi.hoisted(() => ({
|
|
evaluations: 0,
|
|
start: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("./cache-bootstrap.server", () => {
|
|
cacheBootstrap.evaluations += 1;
|
|
return { startCacheSubscribers: cacheBootstrap.start };
|
|
});
|
|
|
|
describe("entry runtime bootstrap boundary", () => {
|
|
beforeEach(() => {
|
|
vi.resetModules();
|
|
cacheBootstrap.evaluations = 0;
|
|
cacheBootstrap.start.mockReset();
|
|
});
|
|
|
|
it("does not import or start the Core cache bootstrap on the Portal surface", async () => {
|
|
const portalBootstrap = await import("./entry-runtime-bootstrap-portal.server");
|
|
|
|
portalBootstrap.startEntryRuntimeServices();
|
|
|
|
expect(cacheBootstrap.evaluations).toBe(0);
|
|
expect(cacheBootstrap.start).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("preserves the Core cache bootstrap at process entry", async () => {
|
|
const coreBootstrap = await import("./entry-runtime-bootstrap-core.server");
|
|
|
|
expect(cacheBootstrap.evaluations).toBe(1);
|
|
coreBootstrap.startEntryRuntimeServices();
|
|
|
|
expect(cacheBootstrap.start).toHaveBeenCalledOnce();
|
|
});
|
|
});
|