Skip to content

Commit

Permalink
tests: enhance utility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tch1b0 committed Jul 22, 2022
1 parent ba12d55 commit 433e19d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/utility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,23 @@ func TestUtility(t *testing.T) {
})

t.Run("Test StringSliceContains function", func(t *testing.T) {
if !utility.SliceContains("Test", []string{"tEst", "setT", "Test"}) {
if !utility.SliceContains("Test", []string{"tEst", "setT", "Test"}) || utility.SliceContains("Test", []string{"idka", "rhiugh", "zuroghz"}) {
t.Fail()
}
if utility.SliceContains("Test", []string{"idka", "rhiugh", "zuroghz"}) {
t.Fail()
})

t.Run("Test URL recognition functions", func(t *testing.T) {
if !utility.IsUrl("https://something.my-url.com") ||
utility.IsUrl("IAmNotAnURL") {
t.Error("URL recognition broken")
}
if !utility.IsGithubRepoUrl("https://github.com/User/Repository") ||
utility.IsGithubRepoUrl("https://github.com/User") {
t.Error("Github Repository URL recognition broken")
}
if !utility.IsUserAndRepo("User/Repository") ||
utility.IsUserAndRepo("UserRepository") {
t.Error("User and Repository recognition broken")
}
})
}

0 comments on commit 433e19d

Please sign in to comment.