Unified · Split
| @@ -1268,6 +1268,15 @@ describe("whether the panel is showing the thread's own pull request", () => { · 1267 unmodified lines | |||
| 1268 | ).toBe(false); | 1268 | ).toBe(false); |
| 1269 | }); | 1269 | }); |
| 1270 | 1270 | ||
| 1271 | it.each([null, "proj-a"])("rejects an unlinked PR for thread project %s", (projectId) => { | ||
| 1272 | expect( | ||
| 1273 | isThreadOwnPullRequest( | ||
| 1274 | { projectId, repository: "acme/app", number: 7 }, | ||
| 1275 | { ...surface, projectId: null }, | ||
| 1276 | ), | ||
| 1277 | ).toBe(false); | ||
| 1278 | }); | ||
| 1279 | |||
| 1271 | it("rejects a thread with no project or no pull request of its own", () => { | 1280 | it("rejects a thread with no project or no pull request of its own", () => { |
| 1272 | expect( | 1281 | expect( |
| 1273 | isThreadOwnPullRequest({ projectId: null, repository: "acme/app", number: 7 }, surface), | 1282 | isThreadOwnPullRequest({ projectId: null, repository: "acme/app", number: 7 }, surface), |
| @@ -138,6 +138,7 @@ export function isThreadOwnPullRequest( · 137 unmodified lines | |||
| 138 | }, | 138 | }, |
| 139 | ): boolean { | 139 | ): boolean { |
| 140 | return ( | 140 | return ( |
| 141 | thread.projectId !== null && | ||
| 141 | thread.projectId === surface.projectId && | 142 | thread.projectId === surface.projectId && |
| 142 | thread.repository === surface.repository && | 143 | thread.repository === surface.repository && |
| 143 | thread.number === surface.number | 144 | thread.number === surface.number |