linkinfo/youtube_test.go

23 lines
406 B
Go
Raw Normal View History

2019-10-04 04:08:03 +00:00
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)
}
}