@@ -131,6 +131,7 @@ defmodule Hexdocs.SearchTest do
131131 assert typesense_search ( % { "q" => package , "query_by" => "package" } ) == [ ]
132132 end
133133
134+ @ tag capture_log: true
134135 test "raises an error if search_data.js file has unexpected format" , % { package: package } do
135136 files = [
136137 { "index.html" , "contents" } ,
@@ -153,6 +154,7 @@ defmodule Hexdocs.SearchTest do
153154 assert typesense_search ( % { "q" => package , "query_by" => "package" } ) == [ ]
154155 end
155156
157+ @ tag capture_log: true
156158 test "raises an error if search_data.json cannot be decoded" , % { package: package } do
157159 files = [
158160 { "index.html" , "contents" } ,
@@ -171,11 +173,11 @@ defmodule Hexdocs.SearchTest do
171173 }
172174 ] }
173175
174- assert msg =~ "Failed to decode search data json for #{ package } 1.0.0: :unexpected_end "
176+ assert msg =~ "Failed to decode search data json for #{ package } 1.0.0"
175177 assert typesense_search ( % { "q" => package , "query_by" => "package" } ) == [ ]
176178 end
177179
178- test "raises an error if search_data has empty items" , % { package: package } do
180+ test "skips indexing if search_data has empty items" , % { package: package } do
179181 files = [
180182 { "index.html" , "contents" } ,
181183 { "dist/search_data-0F918FFD.js" , "searchData={\" items\" :[]}" }
@@ -186,19 +188,12 @@ defmodule Hexdocs.SearchTest do
186188 Hexdocs.Store . put! ( :repo_bucket , key , tar )
187189 ref = Broadway . test_message ( Hexdocs.Queue , queue_search_message ( key ) )
188190
189- assert_receive { :ack , ^ ref , [ ] ,
190- [
191- % Broadway.Message {
192- status: { :error , % RuntimeError { message: msg } , _stacktrace }
193- }
194- ] }
195-
196- assert msg ==
197- "Failed to extract search items and proglang from search data for #{ package } 1.0.0"
191+ assert_receive { :ack , ^ ref , [ _ ] , [ ] }
198192
199193 assert typesense_search ( % { "q" => package , "query_by" => "package" } ) == [ ]
200194 end
201195
196+ @ tag capture_log: true
202197 test "raises an error if search_data has no items" , % { package: package } do
203198 files = [
204199 { "index.html" , "contents" } ,
@@ -223,6 +218,7 @@ defmodule Hexdocs.SearchTest do
223218 assert typesense_search ( % { "q" => package , "query_by" => "package" } ) == [ ]
224219 end
225220
221+ @ tag capture_log: true
226222 test "raises an error when indexing incomplete search items" , % { package: package } do
227223 files = [
228224 { "index.html" , "contents" } ,
@@ -251,9 +247,12 @@ defmodule Hexdocs.SearchTest do
251247
252248 assert msg =~ "Failed to index search item "
253249 assert msg =~ " for #{ package } 1.0.0: "
254- assert msg =~ "Field `doc` has been declared in the schema, but is not found in the document."
250+
251+ assert msg =~
252+ "Field `title` has been declared in the schema, but is not found in the document."
255253 end
256254
255+ @ tag capture_log: true
257256 test "raises an error when indexing invalid search items" , % { package: package } do
258257 files =
259258 [
0 commit comments