-
Notifications
You must be signed in to change notification settings - Fork 0
/
song_test.go
135 lines (127 loc) · 2.68 KB
/
song_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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package main
import (
"testing"
"github.com/stretchr/testify/require"
)
type testVideo struct {
videoTitle string
videoAuthor string
title string
artist string
reliable Reliable
}
func TestRemoveSpacialChars(t *testing.T) {
output := []string{"What is that", ""}
input := []string{"What \"is\" that?", ":,?*\\/<>"}
for i := 0; i < len(output); i++ {
require.Equal(t, output[i], RemoveSpecialChars(input[i]))
}
}
func TestParseTitle(t *testing.T) {
testVideos := []testVideo{
{
"Ava Max - Kings & Queens [Official Music Video]",
"Ava Max",
"Kings & Queens",
"Ava Max",
Yes,
},
{
"Jim Croce - Dont Mess Around With Jim (Remaster Best Quality)",
"remastermusic",
"Dont Mess Around With Jim",
"Jim Croce",
Yes,
},
{
"Tomislav Ivčić - Večeras je naša fešta",
"Torcida1950Solin",
"Večeras je naša fešta",
"Tomislav Ivčić",
Yes,
},
{
"Našoj Ljubavi Je Kraj",
"Oliver Dragojević Crorec Official",
"Našoj Ljubavi Je Kraj",
"Oliver Dragojević Crorec Official",
No,
},
{
"Mausberg (Feat. DJ Quik) - Get Nekkid - HQ",
"Camiousse",
"Get Nekkid",
"Mausberg",
Yes,
},
{
"Siddharta - Ledena (official video) - Album Infra",
"Nika Records",
"Ledena",
"Siddharta",
Yes,
},
{
"DiNo Merlin - Kad si rekla da me voliš (Official Audio) [2000]",
"DiNo Merlin",
"Kad si rekla da me voliš",
"DiNo Merlin",
Yes,
},
{
"Steve Angello & Laidback Luke Feat. Robin S – Show Me Love (Official HD Video) [2009]",
"Ministry of Sound",
"Show Me Love",
"Steve Angello",
Maybe,
},
{
"Logic - Wu Tang Forever ft. Wu Tang Clan (Official Audio)",
"Visionary Music Group",
"Wu Tang Forever ft. Wu Tang Clan",
"Logic",
Yes,
},
{
"Sting - What Could Have Been | Arcane League of Legends | Riot Games Music",
"Riot Games Music",
"What Could Have Been Arcane League of Legends Riot Games Music",
"Sting",
Maybe,
},
{
"TECHNO MIX 2021 | DJD3",
"DJD3",
"TECHNO MIX 2021 DJD3",
"DJD3",
No,
},
{
"OFFICIAL Somewhere over the Rainbow - Israel IZ Kamakawiwoʻole",
"Mountain Apple Company Inc",
"Israel IZ Kamakawiwoʻole",
"OFFICIAL Somewhere over the Rainbow",
Yes,
},
{
`Wu-Tang Clan - C.R.E.A.M. (Official HD Video)`,
`Wu-Tang Clan`,
`C.R.E.A.M.`,
`Wu-Tang Clan`,
Yes,
},
{
`Calle`,
`El Mola - Topic`,
`Calle`,
`El Mola`,
No,
},
}
for _, song := range testVideos {
video := ParseMetadata(song.videoTitle, song.videoAuthor)
require.Equal(t, song.title, video.Title)
require.Equal(t, song.artist, video.Artist)
require.Equal(t, song.reliable, video.Reliable)
}
}