test(converter): pin renderLinkIsUrl behavior - #1565
Open
ferhatelmas wants to merge 1 commit into
Open
Conversation
Add a table-driven test covering the markdown link destination check before replacing the govalidator dependency with stdlib logic. Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
ferhatelmas
force-pushed
the
ferhat/converter-test
branch
from
August 2, 2026 14:58
9bf4187 to
b594332
Compare
LinkinStars
self-requested a review
August 3, 2026 02:45
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a table-driven unit test to lock in renderLinkIsUrl’s current URL-detection behavior ahead of swapping from govalidator to stdlib-based validation.
Changes:
- Introduces
TestRenderLinkIsUrlwith a comprehensive set of URL/non-URL table cases. - Covers edge cases for schemes, hosts/IPs, ports, paths, and disallowed schemes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestRenderLinkIsUrl(t *testing.T) { |
| {"label with trailing hyphen", "ex-.com", false}, | ||
| {"invalid IPv4 quad", "999.1.1.1", false}, | ||
| {"IPv4 with leading zeros", "01.2.3.4", false}, | ||
| {"three letter domain", "a.b", false}, |
Comment on lines
+73
to
+77
| for _, tc := range cases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| assert.Equal(t, tc.want, r.renderLinkIsUrl(tc.in)) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a table-driven test covering the markdown link destination check
before replacing the govalidator dependency with stdlib logic.