Skip to content

Commit

Permalink
Add a test for verifying that the static urls are valid
Browse files Browse the repository at this point in the history
Fixes #150
  • Loading branch information
Jacalz committed Apr 6, 2024
1 parent 8d5a983 commit 551c639
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions internal/util/url_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package util

import (
"net/url"
"reflect"
"testing"
)

func TestURLToGitHubProject(t *testing.T) {
tests := []struct {
name string
subpath string
}{
{"Repository root", ""},
{"Releases", "/releases"},
{"Release v3.0.0", "/releases/v3.0.0"},
{"Supported clients", "/wiki/Supported-clients"},
}

const basepath = https + "://" + github + repo
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
path := basepath + tt.subpath
want, err := url.Parse(path)
if err != nil {
t.Errorf("Failed to parse the path %s: %v", path, err)
return
}

if got := URLToGitHubProject(tt.subpath); !reflect.DeepEqual(got, want) {
t.Errorf("URLToGitHubProject() = %v, want %v", got, want)
}
})
}
}

0 comments on commit 551c639

Please sign in to comment.