You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
406 B

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)
}
}