forked from hum/vcat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcat_test.go
31 lines (24 loc) · 867 Bytes
/
vcat_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package vcat
import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
)
var videourl = "https://www.youtube.com/watch?v=Nb2tebYAaOA" // Jim Keller interview
func TestGetVideoWithLanguageShouldPass(t *testing.T) {
languages, err := GetAvailableLanguages(videourl)
require.NoError(t, err)
require.NotEmpty(t, languages)
// Pick a random language from the available languages and fetch the transcript for the language
lang := languages[rand.Intn(len(languages))]
video, err := GetVideoWithLanguage(videourl, lang.Code)
require.NoError(t, err)
require.NotEmpty(t, video)
require.NotEmpty(t, video.Metadata.Title)
require.NotEmpty(t, video.Transcript)
}
func TestGetAvailableLanguagesReturnsNonZeroSliceShouldPass(t *testing.T) {
languages, err := GetAvailableLanguages(videourl)
require.NoError(t, err)
require.NotEmpty(t, languages)
}