test: newznab category tests

This commit is contained in:
l3uddz
2021-11-21 13:33:44 +00:00
parent a4d8a0e4cc
commit 6a31a05e9a

92
util/newznab_test.go Normal file
View File

@@ -0,0 +1,92 @@
package util
import "testing"
func TestContainsMovieCategory(t *testing.T) {
type args struct {
cats []string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "want true",
args: args{
cats: []string{
"2000",
"5000",
},
},
want: true,
}, {
name: "want false",
args: args{
cats: []string{
"3000",
"4000",
},
},
want: false,
}, {
name: "want false",
args: args{
cats: []string{},
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := ContainsMovieCategory(tt.args.cats); got != tt.want {
t.Errorf("ContainsMovieCategory() = %v, want %v", got, tt.want)
}
})
}
}
func TestContainsTvCategory(t *testing.T) {
type args struct {
cats []string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "want true",
args: args{
cats: []string{
"5000",
"4000",
"2000",
},
},
want: true,
}, {
name: "want false",
args: args{
cats: []string{
"3000",
"4000",
},
},
want: false,
}, {
name: "want false",
args: args{
cats: []string{},
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := ContainsTvCategory(tt.args.cats); got != tt.want {
t.Errorf("ContainsTvCategory() = %v, want %v", got, tt.want)
}
})
}
}