Open History to see the last commit
1import { QueryClient } from "@tanstack/react-query";
2import { describe, expect, it } from "vitest";
3import {
4 gitMutationKeys,
5 gitPullMutationOptions,
6 gitRunStackedActionMutationOptions,
7} from "./gitReactQuery";
8
9describe("gitMutationKeys", () => {
10 it("scopes stacked action keys by cwd", () => {
11 expect(gitMutationKeys.runStackedAction("/repo/a")).not.toEqual(
12 gitMutationKeys.runStackedAction("/repo/b"),
13 );
14 });
15
16 it("scopes pull keys by cwd", () => {
17 expect(gitMutationKeys.pull("/repo/a")).not.toEqual(gitMutationKeys.pull("/repo/b"));
18 });
19});
20
21describe("git mutation options", () => {
22 const queryClient = new QueryClient();
23
24 it("attaches cwd-scoped mutation key for runStackedAction", () => {
25 const options = gitRunStackedActionMutationOptions({ cwd: "/repo/a", queryClient });
26 expect(options.mutationKey).toEqual(gitMutationKeys.runStackedAction("/repo/a"));
27 });
28
29 it("attaches cwd-scoped mutation key for pull", () => {
30 const options = gitPullMutationOptions({ cwd: "/repo/a", queryClient });
31 expect(options.mutationKey).toEqual(gitMutationKeys.pull("/repo/a"));
32 });
33});