Showing the changes to packages/shared/src/sourceControl.test.ts (1 of 172 files). Show all
Unified · Split
| @@ -1,6 +1,7 @@ | |||
| 1 | import { describe, expect, it } from "vite-plus/test"; | 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | 2 | ||
| 3 | import { | 3 | import { |
| 4 | sourceControlRepositorySelector, | ||
| 4 | detectSourceControlProviderFromRemoteUrl, | 5 | detectSourceControlProviderFromRemoteUrl, |
| 5 | getChangeRequestTerminologyForKind, | 6 | getChangeRequestTerminologyForKind, |
| 6 | isSshRemoteUrl, | 7 | isSshRemoteUrl, |
| @@ -160,3 +161,34 @@ describe("isSshRemoteUrl", () => { · 153 unmodified lines | |||
| 160 | expect(isSshRemoteUrl("deploy@github.com/project/repo")).toBe(false); | 161 | expect(isSshRemoteUrl("deploy@github.com/project/repo")).toBe(false); |
| 161 | }); | 162 | }); |
| 162 | }); | 163 | }); |
| 164 | |||
| 165 | it("names an Azure DevOps repository by its own name, not its project path", () => { | ||
| 166 | // `az repos pr list --repository` takes a name and detects the organisation and project from | ||
| 167 | // the checkout; the recorded `org/project/_git/repo` path is refused, and the repository then | ||
| 168 | // reads as unavailable on the page. | ||
| 169 | const selector = sourceControlRepositorySelector({ | ||
| 170 | provider: "azure-devops", | ||
| 171 | displayName: "contoso/payments/_git/checkout", | ||
| 172 | owner: "contoso", | ||
| 173 | name: "checkout", | ||
| 174 | }); | ||
| 175 | expect(selector).toBe("checkout"); | ||
| 176 | }); | ||
| 177 | |||
| 178 | it("falls back to the path's last segment where an Azure identity has no name", () => { | ||
| 179 | const selector = sourceControlRepositorySelector({ | ||
| 180 | provider: "azure-devops", | ||
| 181 | displayName: "contoso/payments/_git/checkout", | ||
| 182 | }); | ||
| 183 | expect(selector).toBe("checkout"); | ||
| 184 | }); | ||
| 185 | |||
| 186 | it("keeps a GitLab identity's whole path, because a nested group is part of the name", () => { | ||
| 187 | const selector = sourceControlRepositorySelector({ | ||
| 188 | provider: "gitlab", | ||
| 189 | displayName: "group/subgroup/service", | ||
| 190 | owner: "group", | ||
| 191 | name: "service", | ||
| 192 | }); | ||
| 193 | expect(selector).toBe("group/subgroup/service"); | ||
| 194 | }); | ||