Open History to see the last commit
1import { describe, expect, it } from "vitest";
2
3import { parsePullRequestReference } from "./pullRequestReference";
4
5describe("parsePullRequestReference", () => {
6 it("accepts GitHub pull request URLs", () => {
7 expect(parsePullRequestReference("https://github.com/pingdotgg/t3code/pull/42")).toBe(
8 "https://github.com/pingdotgg/t3code/pull/42",
9 );
10 });
11
12 it("accepts raw numbers", () => {
13 expect(parsePullRequestReference("42")).toBe("42");
14 });
15
16 it("accepts #number references", () => {
17 expect(parsePullRequestReference("#42")).toBe("#42");
18 });
19
20 it("rejects non-pull-request input", () => {
21 expect(parsePullRequestReference("feature/my-branch")).toBeNull();
22 });
23});