Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions windows/tauri/src/platform/core-result-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ describe("git checkout result adaptation", () => {
});
});

describe("git tag checkout result adaptation", () => {
test("maps a successful core tag checkout to the UI checkout result", () => {
const result = adaptCoreResult(
"git_checkout_tag",
{ repoPath: "C:/work", name: "v0.3.0" },
{ output: "HEAD is now at abc1234 Release 0.3.0\n", exitCode: 0 },
);

expect(result).toEqual({
success: true,
hasChanges: false,
message: "HEAD is now at abc1234 Release 0.3.0",
});
});

test("reports failure when the core tag checkout exited non-zero", () => {
const result = adaptCoreResult(
"git_checkout_tag",
{ repoPath: "C:/work", name: "missing-tag" },
{ output: "error: pathspec 'missing-tag' did not match", exitCode: 1 },
);

expect(result).toEqual({
success: false,
hasChanges: false,
message: "error: pathspec 'missing-tag' did not match",
});
});
});

describe("git checkout preflight adaptation", () => {
test("reports blocked paths returned by the shared core", () => {
const result = adaptCoreResult(
Expand Down
7 changes: 5 additions & 2 deletions windows/tauri/src/platform/core-result-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ export function adaptCoreResult<T>(
: [];
return { blocked: blockingPaths.length > 0, blockingPaths } as T;
}
case "git_checkout_tag":
return { success: true, hasChanges: false, message: "" } as T;
case "git_checkout_tag": {
const exitCode = typeof data.exitCode === "number" ? data.exitCode : 0;
const output = typeof data.output === "string" ? data.output.trim() : "";
return { success: exitCode === 0, hasChanges: false, message: output } as T;
}
case "git_operation_state": {
const kind = typeof data.kind === "string" ? data.kind : "";
if (!kind) {
Expand Down
Loading