Add coverage for no-upstream default-branch quick actions

- test push-only quick action on default branch without upstream
- verify push and create PR stay disabled when branch is behind
This commit is contained in:
Julius Marminge committed 2026-03-01 11:00:13 -08:00
1 parent 4dfc28ff26
commit 57ebd79211
1 file changed
+57
@@ -608,6 +608,63 @@ describe("when: branch has no upstream configured", () => {
},
]);
});
it("resolveQuickAction uses push-only on default branch when no upstream exists", () => {
const quick = resolveQuickAction(
status({
branch: "main",
hasUpstream: false,
aheadCount: 0,
pr: null,
}),
false,
true,
);
assert.deepInclude(quick, {
kind: "run_action",
action: "commit_push",
label: "Push",
disabled: false,
});
});
it("buildMenuItems still disables push and create PR when branch is behind", () => {
const items = buildMenuItems(
status({
hasUpstream: false,
behindCount: 1,
aheadCount: 0,
pr: null,
}),
false,
);
assert.deepEqual(items, [
{
id: "commit",
label: "Commit",
disabled: true,
icon: "commit",
kind: "open_dialog",
dialogAction: "commit",
},
{
id: "push",
label: "Push",
disabled: true,
icon: "push",
kind: "open_dialog",
dialogAction: "push",
},
{
id: "pr",
label: "Create PR",
disabled: true,
icon: "pr",
kind: "open_dialog",
dialogAction: "create_pr",
},
]);
});
});
describe("requiresDefaultBranchConfirmation", () => {