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
} {
{
2022-11-19 18:43:56 +08:00
urlStr : "https://www.bytebase.com/blog/sql-review-tool-for-devs" ,
2022-11-19 16:58:55 +08:00
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 {
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 )
}
}