23 lines
406 B
Go
23 lines
406 B
Go
package linkinfo
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestYoutubeInfoApi_Handler(t *testing.T) {
|
|
api := New(&YoutubeOptions{
|
|
Key: os.Getenv("YOUTUBE_KEY"),
|
|
})
|
|
|
|
info, err := api.Youtube.Handler("https://www.youtube.com/watch?v=1r4Md5WKaqs")
|
|
|
|
if err != nil {
|
|
t.Fatal("Error getting youtube info:", err)
|
|
}
|
|
|
|
if info.Title != "CHVRCHES - Graves [04:46]" {
|
|
t.Fatal("Unexpected title", info.Title)
|
|
}
|
|
}
|