DEV: Async category search for sidebar modal (#25686)

This commit is contained in:
Daniel Waterworth
2024-02-20 11:24:30 -06:00
committed by GitHub
parent 716e3a4dd5
commit 13083d03ae
10 changed files with 266 additions and 92 deletions

View File

@ -1127,6 +1127,30 @@ RSpec.describe CategoriesController do
[category, category2, subcategory].each { |c| SearchIndexer.index(c, force: true) }
end
context "without include_ancestors" do
it "doesn't return ancestors" do
get "/categories/search.json", params: { term: "Notfoo" }
expect(response.parsed_body).not_to have_key("ancestors")
end
end
context "with include_ancestors=false" do
it "returns ancestors" do
get "/categories/search.json", params: { term: "Notfoo", include_ancestors: false }
expect(response.parsed_body).not_to have_key("ancestors")
end
end
context "with include_ancestors=true" do
it "returns ancestors" do
get "/categories/search.json", params: { term: "Notfoo", include_ancestors: true }
expect(response.parsed_body).to have_key("ancestors")
end
end
context "with term" do
it "returns categories" do
get "/categories/search.json", params: { term: "Foo" }