generated from oklookat/gostarter
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
track_test.go
51 lines (43 loc) · 880 Bytes
/
track_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package govkm
import (
"context"
"testing"
)
func TestTrack(t *testing.T) {
ctx := context.Background()
cl := getClient(t)
resp, err := cl.Track(ctx, _trackIds[0])
if err != nil {
t.Fatal(err)
}
if len(resp.Data.Track.APIID) == 0 {
t.Fatal("len(resp.Data.Track.APIID) == 0")
}
}
func TestTracks(t *testing.T) {
ctx := context.Background()
cl := getClient(t)
resp, err := cl.Tracks(ctx, _trackIds[:])
if err != nil {
t.Fatal(err)
}
if len(resp.Data.Tracks) == 0 {
t.Fatal("len(resp.Data.Tracks) == 0")
}
if len(resp.Data.Tracks[0].APIID) == 0 {
t.Fatal("len(resp.Data.Tracks[0].APIID) == 0")
}
}
func TestLikeUnlikeTrack(t *testing.T) {
ctx := context.Background()
cl := getClient(t)
id := _trackIds[0]
_, err := cl.LikeTrack(ctx, id)
if err != nil {
t.Fatal(err)
}
_, err = cl.UnlikeTrack(ctx, id)
if err != nil {
t.Fatal(err)
}
}