mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
805 B
Go
29 lines
805 B
Go
2 years ago
|
package getter
|
||
2 years ago
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
2 years ago
|
func TestGetHTMLMeta(t *testing.T) {
|
||
2 years ago
|
tests := []struct {
|
||
2 years ago
|
urlStr string
|
||
2 years ago
|
htmlMeta HTMLMeta
|
||
|
}{
|
||
|
{
|
||
2 years ago
|
urlStr: "https://www.bytebase.com/blog/sql-review-tool-for-devs",
|
||
2 years ago
|
htmlMeta: HTMLMeta{
|
||
|
Title: "The SQL Review Tool for Developers",
|
||
|
Description: "Reviewing SQL can be somewhat tedious, yet is essential to keep your database fleet reliable. At Bytebase, we are building a developer-first SQL review tool to empower the DevOps system.",
|
||
|
Image: "https://www.bytebase.com/static/blog/sql-review-tool-for-devs/dev-fighting-dba.webp",
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
for _, test := range tests {
|
||
2 years ago
|
metadata, err := GetHTMLMeta(test.urlStr)
|
||
2 years ago
|
require.NoError(t, err)
|
||
|
require.Equal(t, test.htmlMeta, *metadata)
|
||
|
}
|
||
|
}
|