FIX: Show only top categories in first category-drop (#24575)

This commit is contained in:
Bianca Nenciu
2023-11-29 09:41:25 +02:00
committed by GitHub
parent b09422428d
commit dbb8b66a37
3 changed files with 23 additions and 3 deletions

View File

@ -1096,6 +1096,17 @@ RSpec.describe CategoriesController do
"Foobar",
)
end
it "can return only top-level categories" do
get "/categories/search.json", params: { parent_category_id: -1 }
expect(response.parsed_body["categories"].size).to eq(3)
expect(response.parsed_body["categories"].map { |c| c["name"] }).to contain_exactly(
"Uncategorized",
"Foo",
"Notfoo",
)
end
end
context "with include_uncategorized" do