forked from jaswdr/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyoutube_test.go
More file actions
32 lines (27 loc) · 728 Bytes
/
youtube_test.go
File metadata and controls
32 lines (27 loc) · 728 Bytes
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
32
package faker
import (
"strings"
"testing"
)
func TestGenerateVideoID(t *testing.T) {
y := New().YouTube()
Expect(t, 11, len(y.GenerateVideoID()))
}
func TestGenerateFullURL(t *testing.T) {
y := New().YouTube()
split := strings.Split(y.GenerateFullURL(), "v=")
Expect(t, "www.youtube.com/watch?", split[0])
Expect(t, 11, len(split[1]))
}
func TestGenerateShareURL(t *testing.T) {
y := New().YouTube()
split := strings.Split(y.GenerateShareURL(), "/")
Expect(t, "youtu.be", split[0])
Expect(t, 11, len(split[1]))
}
func TestGenerateEmbededURL(t *testing.T) {
y := New().YouTube()
split := strings.Split(y.GenerateEmbededURL(), "embed/")
Expect(t, "www.youtube.com/", split[0])
Expect(t, 11, len(split[1]))
}