Skip to content

test(converter): pin renderLinkIsUrl behavior - #1565

Open
ferhatelmas wants to merge 1 commit into
apache:devfrom
ferhatelmas:ferhat/converter-test
Open

test(converter): pin renderLinkIsUrl behavior#1565
ferhatelmas wants to merge 1 commit into
apache:devfrom
ferhatelmas:ferhat/converter-test

Conversation

@ferhatelmas

Copy link
Copy Markdown
Contributor

Add a table-driven test covering the markdown link destination check
before replacing the govalidator dependency with stdlib logic.

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
ferhatelmas force-pushed the ferhat/converter-test branch from 9bf4187 to b594332 Compare August 2, 2026 14:58
@LinkinStars LinkinStars self-assigned this Aug 3, 2026
@LinkinStars
LinkinStars self-requested a review August 3, 2026 02:45
@mingcheng
mingcheng requested a lite review from Copilot August 5, 2026 09:47

@mingcheng mingcheng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TestRenderLinkIsUrl with 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))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants