refactor: 리펙토링
This commit is contained in:
@@ -219,6 +219,41 @@ describe("TanStack cross-context cache coordinator", () => {
|
||||
expect(harness.publish).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("rejects a mandatory local reset when query cancellation fails", async () => {
|
||||
const client = createClient();
|
||||
client.setQueryData(["resource-a", 1, "list"], ["private-old-scope"]);
|
||||
vi.spyOn(client, "cancelQueries").mockRejectedValue(
|
||||
new Error("cancellation failed"),
|
||||
);
|
||||
const clear = vi.spyOn(client, "clear");
|
||||
const coordinator = createTanStackCacheCoordinator({
|
||||
queryClient: client,
|
||||
queryRegistry: queryRegistry(),
|
||||
});
|
||||
|
||||
await expect(coordinator.resetLocal()).rejects.toThrow(
|
||||
"mandatory query cancellation failed",
|
||||
);
|
||||
expect(clear).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("composes with no installed query topics", () => {
|
||||
// §24.12: removing the reference feature leaves the common runtime intact.
|
||||
// A template with no installed feature has zero invalidation topics, which
|
||||
// is a legitimate state, not a configuration defect.
|
||||
const harness = crossContextHarness();
|
||||
const coordinator = createTanStackCacheCoordinator({
|
||||
queryClient: createClient(),
|
||||
queryRegistry: Object.freeze({}),
|
||||
crossContext: harness.transport,
|
||||
});
|
||||
|
||||
// A remote hint for a topic this build does not install is ignored, not fatal.
|
||||
harness.deliver("qinv.topic-a");
|
||||
expect(() => coordinator.beginMutation([])).not.toThrow();
|
||||
coordinator.dispose();
|
||||
});
|
||||
|
||||
it("rejects an unregistered topic before opening a mutation lease", () => {
|
||||
const coordinator = createTanStackCacheCoordinator({
|
||||
queryClient: createClient(),
|
||||
|
||||
Reference in New Issue
Block a user