-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add tests for
replaceYoutubeURL
- Loading branch information
Showing
3 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
25 changes: 25 additions & 0 deletions
25
src/wp2hugo/internal/hugogenerator/hugopage/wordpress_youtube_converter_test.go
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package hugopage | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestReplaceYoutubeURL1(t *testing.T) { | ||
const htmlData = "This is a test with a youtube link:\nhttps://www.youtube.com/watch?v=1234567890" | ||
const expected = "This is a test with a youtube link:\n{{< youtube 1234567890 >}}" | ||
assert.Equal(t, expected, replacePlaintextYoutubeURL(htmlData)) | ||
} | ||
|
||
func TestReplaceYoutubeURL2(t *testing.T) { | ||
const htmlData = "This is a test with a youtube link: https://www.youtube.com/watch?v=1234567890" | ||
const expected = "This is a test with a youtube link: {{< youtube 1234567890 >}}" | ||
assert.Equal(t, expected, replacePlaintextYoutubeURL(htmlData)) | ||
} | ||
|
||
func TestReplaceYoutubeURL3(t *testing.T) { | ||
const htmlData = "This is a test with a youtube link:\thttps://www.youtube.com/watch?v=1234567890 whatever" | ||
const expected = "This is a test with a youtube link:\t{{< youtube 1234567890 >}} whatever" | ||
assert.Equal(t, expected, replacePlaintextYoutubeURL(htmlData)) | ||
} |