Skip to content

Commit

Permalink
test: add test for md link creation
Browse files Browse the repository at this point in the history
  • Loading branch information
matty-rose committed Oct 24, 2021
1 parent 71ee5e0 commit deed3c4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/document/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,28 @@ func TestMarkdownWriteTable(t *testing.T) {
assert.Equal(t, tc.expectedDoc, doc.Render())
}
}

func TestCreateMarkdownLink(t *testing.T) {
t.Parallel()

testCases := []struct {
title string
url string
expectedLink string
}{
{
"title",
"www.google.com",
"[title](www.google.com)",
},
{
"a longer title",
"www.google.com/a/nested/page",
"[a longer title](www.google.com/a/nested/page)",
},
}

for _, tc := range testCases {
assert.Equal(t, tc.expectedLink, document.CreateMarkdownLink(tc.title, tc.url))
}
}

0 comments on commit deed3c4

Please sign in to comment.