1
0
Fork 0
forked from 0x2E/fusion
fusion/pkg/feedfinder/finder_test.go
Yuan 4c79b2b2fa
Fix http proxy (#144)
* update deps

* make the sniff package independent

* rename sniffer to feedfinder for  a more neutral meaning

* allow setting Proxy when creating a feed
2025-04-24 01:18:44 +08:00

27 lines
696 B
Go

package feedfinder
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFormatLinkToAbs(t *testing.T) {
type item struct {
base string
link string
want string
}
table := []item{
{base: "https://x.xx", link: "https://1.xx", want: "https://1.xx"},
{base: "https://x.xx", link: "", want: "https://x.xx"},
{base: "https://x.xx/1/", link: "/x/index.xml", want: "https://x.xx/x/index.xml"},
{base: "https://x.xx/1/", link: "x/index.xml", want: "https://x.xx/1/x/index.xml"},
{base: "https://x.xx/1", link: "index.xml", want: "https://x.xx/index.xml"},
}
for _, tt := range table {
res := formatLinkToAbs(tt.base, tt.link)
assert.Equal(t, tt.want, res)
}
}