update regex to check url scheme seprately

This commit is contained in:
Patrick Jones
2021-08-12 10:39:24 -07:00
parent 280ee39d14
commit a55ea9ec6a
3 changed files with 23 additions and 20 deletions

View File

@@ -118,7 +118,7 @@ func TestValidateURLTokenURL(t *testing.T) {
}
for _, tt := range urlValidityTests {
t.Run(" "+tt.input, func(t *testing.T) { // We prepend a space ahead of the test input when outputting for sake of readability.
valid := validateURL(tt.input, tt.pattern)
valid := validateURL(tt.input, tt.pattern, "https")
if valid != tt.result {
t.Errorf("got %v, want %v", valid, tt.result)
}
@@ -147,7 +147,7 @@ func TestValidateURLImpersonateURL(t *testing.T) {
}
for _, tt := range urlValidityTests {
t.Run(" "+tt.input, func(t *testing.T) { // We prepend a space ahead of the test input when outputting for sake of readability.
valid := validateURL(tt.input, tt.pattern)
valid := validateURL(tt.input, tt.pattern, "https")
if valid != tt.result {
t.Errorf("got %v, want %v", valid, tt.result)
}