test: newznab category tests
This commit is contained in:
92
util/newznab_test.go
Normal file
92
util/newznab_test.go
Normal 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user