- add `gitMutationKeys` and attach mutation keys across git mutation options - switch GitActionsControl loading state to `useIsMutating` with cwd-scoped keys - add tests for cwd-scoped mutation keys and mutation option wiring
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { QueryClient } from "@tanstack/react-query";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
gitMutationKeys,
|
|
gitPullMutationOptions,
|
|
gitRunStackedActionMutationOptions,
|
|
} from "./gitReactQuery";
|
|
|
|
describe("gitMutationKeys", () => {
|
|
it("scopes stacked action keys by cwd", () => {
|
|
expect(gitMutationKeys.runStackedAction("/repo/a")).not.toEqual(
|
|
gitMutationKeys.runStackedAction("/repo/b"),
|
|
);
|
|
});
|
|
|
|
it("scopes pull keys by cwd", () => {
|
|
expect(gitMutationKeys.pull("/repo/a")).not.toEqual(gitMutationKeys.pull("/repo/b"));
|
|
});
|
|
});
|
|
|
|
describe("git mutation options", () => {
|
|
const queryClient = new QueryClient();
|
|
|
|
it("attaches cwd-scoped mutation key for runStackedAction", () => {
|
|
const options = gitRunStackedActionMutationOptions({ cwd: "/repo/a", queryClient });
|
|
expect(options.mutationKey).toEqual(gitMutationKeys.runStackedAction("/repo/a"));
|
|
});
|
|
|
|
it("attaches cwd-scoped mutation key for pull", () => {
|
|
const options = gitPullMutationOptions({ cwd: "/repo/a", queryClient });
|
|
expect(options.mutationKey).toEqual(gitMutationKeys.pull("/repo/a"));
|
|
});
|
|
});
|