2022-11-19 18:43:56 +08:00
|
|
|
package getter
|
2022-11-19 16:58:55 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2022-11-19 18:43:56 +08:00
|
|
|
func TestGetHTMLMeta(t *testing.T) {
|
2022-11-19 16:58:55 +08:00
|
|
|
tests := []struct {
|
2022-11-19 18:43:56 +08:00
|
|
|
urlStr string
|
2022-11-19 16:58:55 +08:00
|
|
|
htmlMeta HTMLMeta
|
2023-04-02 09:28:02 +08:00
|
|
|
}{}
|
2022-11-19 16:58:55 +08:00
|
|
|
for _, test := range tests {
|
2022-11-19 18:43:56 +08:00
|
|
|
metadata, err := GetHTMLMeta(test.urlStr)
|
2022-11-19 16:58:55 +08:00
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, test.htmlMeta, *metadata)
|
|
|
|
}
|
|
|
|
}
|