Skip to content

Commit

Permalink
add tests for linking commit URL for GHE repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Oct 3, 2024
1 parent 7df73cb commit 581f326
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions reflink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,24 @@ func TestLinkRefs(t *testing.T) {
input: "**https://github.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe**",
want: "**[`foo/bar@1d457ba853`](https://github.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe)**",
},
{
what: "commit URL with GHE",
input: "https://github.company.com/u/r/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe",
want: "[`1d457ba853`](https://github.company.com/u/r/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe)",
repoURL: "https://github.company.com/u/r",
},
{
what: "commit URL of outside repository with GHE",
input: "https://github.company.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe",
want: "[`foo/bar@1d457ba853`](https://github.company.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe)",
repoURL: "https://github.company.com/u/r",
},
{
what: "GitHub URL is not linked with GHE",
input: "https://github.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe",
want: "https://github.com/foo/bar/commit/1d457ba853aa10f9a6c925a1b73d5aed38066ffe",
repoURL: "https://github.company.com/u/r",
},
}

for _, tc := range tests {
Expand Down

0 comments on commit 581f326

Please sign in to comment.