Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fixing test for categories

Cette révision appartient à :
akuma06 2017-07-06 21:59:43 +02:00
Parent e54a2e59e2
révision 4d0c3a18c8

Voir le fichier

@ -20,7 +20,7 @@ var _ = func() (_ struct{}) {
}()
func TestGetCategories(t *testing.T) {
cats := GetCategories()
cats := All()
if len(cats) == 0 {
t.Skip("Couldn't load categories to test Categories")
}
@ -30,13 +30,13 @@ func TestGetCategories(t *testing.T) {
}
func TestCategoryExists(t *testing.T) {
if CategoryExists("k") {
if Exists("k") {
t.Error("Category that shouldn't exist return true")
}
}
func TestGetCategoriesSelect(t *testing.T) {
cats := GetCategoriesSelect(true, false)
cats := GetSelect(true, false)
for _, value := range cats {
split := strings.Split(value, "_")
if len(split) != 2 {
@ -46,7 +46,7 @@ func TestGetCategoriesSelect(t *testing.T) {
t.Errorf("The function doesn't filter out child categories, expected '', got %s", split[1])
}
}
cats = GetCategoriesSelect(false, true)
cats = GetSelect(false, true)
for _, value := range cats {
split := strings.Split(value, "_")
if len(split) != 2 {
@ -56,8 +56,8 @@ func TestGetCategoriesSelect(t *testing.T) {
t.Error("The function doesn't filter out parent categories, expected a string, got nothing")
}
}
cats = GetCategoriesSelect(true, true)
if len(cats) != len(GetCategories()) {
cats = GetSelect(true, true)
if len(cats) != len(All()) {
t.Errorf("Same amount of categories isn't return when no filter applied")
}
}