mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Refactor feed validator
This commit is contained in:
parent
b35fece3d5
commit
806b9545a9
32 changed files with 588 additions and 521 deletions
22
validator/validator_test.go
Normal file
22
validator/validator_test.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2021 Frédéric Guillot. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package validator // import "miniflux.app/validator"
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIsValidURL(t *testing.T) {
|
||||
scenarios := map[string]bool{
|
||||
"https://www.example.org": true,
|
||||
"http://www.example.org/": true,
|
||||
"www.example.org": false,
|
||||
}
|
||||
|
||||
for link, expected := range scenarios {
|
||||
result := isValidURL(link)
|
||||
if result != expected {
|
||||
t.Errorf(`Unexpected result, got %v instead of %v`, result, expected)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue