scaffold/internal/project/local_test.go
2020-02-20 08:31:22 +01:00

34 lines
648 B
Go

package project
import (
"net/url"
"testing"
)
func TestLocalMatch(t *testing.T) {
testCases := []struct {
RawURL string
ShouldMatch bool
}{
{"local://wpetit/scaffold", true},
{"./forge.cadoles.com/wpetit/scaffold", true},
}
local := NewLocalFetcher()
for _, tc := range testCases {
func(rawURL string, shouldMatch bool) {
t.Run(rawURL, func(t *testing.T) {
projectURL, err := url.Parse(rawURL)
if err != nil {
t.Fatal(err)
}
if e, g := shouldMatch, local.Match(projectURL); g != e {
t.Errorf("local.Match(url): expected '%v', got '%v'", e, g)
}
})
}(tc.RawURL, tc.ShouldMatch)
}
}