feat(plugins): add source-control extension contracts (#2117)

This commit is contained in:
José Almeida
2026-08-13 08:29:29 +01:00
committed by GitHub
parent 064b852884
commit f218880ecb
530 changed files with 39054 additions and 7518 deletions
+37 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { t } from "@/lib/i18n";
import { determinePrimaryAction } from "./vcs-split-button";
import { determinePrimaryAction, hasOpenChangeRequest } from "./vcs-split-button";
/**
* The VCS tooltips used to build their plural by hand:
@@ -43,6 +43,42 @@ describe("vcs split-button count-bearing copy", () => {
});
});
describe("hasOpenChangeRequest", () => {
it("recognizes a registered provider review as the native task change request", () => {
expect(
hasOpenChangeRequest(undefined, [
{
providerId: "bitbucket",
reviewKey: "workspace/repo#42",
title: "Fix auth",
url: "https://bitbucket.test/pull-requests/42",
connectionScope: "https://bitbucket.test",
repositoryId: "repository-1",
changeRequestNumber: 42,
state: "OPEN",
},
]),
).toBe(true);
});
it("does not treat merged or closed reviews as open", () => {
expect(
hasOpenChangeRequest("closed", [
{
providerId: "bitbucket",
reviewKey: "workspace/repo#42",
title: "Fix auth",
url: "https://bitbucket.test/pull-requests/42",
connectionScope: "https://bitbucket.test",
repositoryId: "repository-1",
changeRequestNumber: 42,
state: "MERGED",
},
]),
).toBe(false);
});
});
describe("vcs split-button remote action semantics", () => {
it("uses the upstream-relative count for a linked PR push", () => {
expect(determinePrimaryAction(0, 1, 7, true)).toBe("push");