@@ -8,7 +8,7 @@ class EditSuggestionWorkerTest < ActiveSupport::TestCase
88 mock_nominatim
99 end
1010
11- test 'Get suggestions for a material' do
11+ test 'get suggestions for a material' do
1212 material = materials ( :biojs )
1313
1414 assert_nil material . edit_suggestion
@@ -27,7 +27,7 @@ class EditSuggestionWorkerTest < ActiveSupport::TestCase
2727 assert_includes material . edit_suggestion . scientific_topics . map ( &:preferred_label ) , 'Molecular dynamics'
2828 end
2929
30- test 'Get suggestions for an event' do
30+ test 'get suggestions for an event' do
3131 event = events ( :portal_event )
3232
3333 assert_nil event . edit_suggestion
@@ -46,7 +46,7 @@ class EditSuggestionWorkerTest < ActiveSupport::TestCase
4646 assert_includes event . edit_suggestion . scientific_topics . map ( &:preferred_label ) , 'Molecular dynamics'
4747 end
4848
49- test 'Get suggestions for a workflow' do
49+ test 'get suggestions for a workflow' do
5050 workflow = workflows ( :two )
5151
5252 assert_nil workflow . edit_suggestion
@@ -65,7 +65,7 @@ class EditSuggestionWorkerTest < ActiveSupport::TestCase
6565 assert_includes workflow . edit_suggestion . scientific_topics . map ( &:preferred_label ) , 'Molecular dynamics'
6666 end
6767
68- test "Don 't get suggestions when description is blank" do
68+ test "don 't get suggestions when description is blank" do
6969 event = events ( :no_description_event )
7070
7171 assert_nil event . edit_suggestion
@@ -80,4 +80,14 @@ class EditSuggestionWorkerTest < ActiveSupport::TestCase
8080
8181 assert_nil event . edit_suggestion
8282 end
83+
84+ test 'gracefully handle getting suggestions for material that no longer exists' do
85+ Sidekiq ::Testing . inline! do
86+ assert_no_difference ( 'EditSuggestion.count' ) do
87+ assert_nothing_raised do
88+ EditSuggestionWorker . perform_async ( [ Material . maximum ( :id ) + 1 , 'Material' ] )
89+ end
90+ end
91+ end
92+ end
8393end
0 commit comments