|
1 | | -import { describe, expect, it, vi } from "vite-plus/test"; |
| 1 | +import { describe, expect, it } from "vite-plus/test"; |
2 | 2 |
|
3 | 3 | import { |
4 | 4 | changeRequestRepositoryUrl, |
5 | 5 | findProjectForChangeRequest, |
6 | 6 | gitHubPullRequestBrowserUrl, |
7 | 7 | matchesLinkedPullRequestUrl, |
8 | | - openPullRequestLink, |
9 | 8 | parseChangeRequestUrl, |
10 | 9 | pullRequestCandidateUrlFromReferenceAutolink, |
11 | | - PullRequestLinkOpenError, |
12 | 10 | shouldOpenPullRequestExternally, |
13 | 11 | } from "./openPullRequestLink"; |
14 | 12 | import { ProjectId, type RepositoryIdentity } from "@t3tools/contracts"; |
@@ -184,33 +182,6 @@ describe("matchesLinkedPullRequestUrl", () => { |
184 | 182 | }); |
185 | 183 | }); |
186 | 184 |
|
187 | | -describe("openPullRequestLink", () => { |
188 | | - it("opens the requested pull request URL", async () => { |
189 | | - const openExternal = vi.fn(async () => undefined); |
190 | | - const targetUrl = "https://github.com/pingdotgg/t3code/pull/123"; |
191 | | - |
192 | | - await openPullRequestLink({ openExternal }, targetUrl); |
193 | | - |
194 | | - expect(openExternal).toHaveBeenCalledExactlyOnceWith(targetUrl); |
195 | | - }); |
196 | | - |
197 | | - it("reports bridge failures with a safe target origin", async () => { |
198 | | - const cause = new Error("desktop shell unavailable"); |
199 | | - const targetUrl = "https://github.com/pingdotgg/t3code/pull/123?token=secret"; |
200 | | - const openExternal = vi.fn(async () => Promise.reject(cause)); |
201 | | - |
202 | | - const result = openPullRequestLink({ openExternal }, targetUrl); |
203 | | - |
204 | | - await expect(result).rejects.toEqual( |
205 | | - new PullRequestLinkOpenError({ |
206 | | - targetOrigin: "https://github.com", |
207 | | - cause, |
208 | | - }), |
209 | | - ); |
210 | | - await expect(result).rejects.not.toHaveProperty("message", expect.stringContaining("secret")); |
211 | | - }); |
212 | | -}); |
213 | | - |
214 | 185 | describe("shouldOpenPullRequestExternally", () => { |
215 | 186 | it("uses the browser for command-click and control-click", () => { |
216 | 187 | expect(shouldOpenPullRequestExternally({ metaKey: true, ctrlKey: false })).toBe(true); |
|
0 commit comments