@ -5,6 +5,10 @@ RSpec.describe BulkUploadErrorSummaryTableComponent, type: :component do
let ( :bulk_upload ) { create ( :bulk_upload ) }
let ( :bulk_upload ) { create ( :bulk_upload ) }
before do
stub_const ( " BulkUploadErrorSummaryTableComponent::DISPLAY_THRESHOLD " , 0 )
end
context " when no errors " do
context " when no errors " do
it " does not renders any rows " do
it " does not renders any rows " do
result = render_inline ( component )
result = render_inline ( component )
@ -12,6 +16,19 @@ RSpec.describe BulkUploadErrorSummaryTableComponent, type: :component do
end
end
end
end
context " when below threshold " do
before do
stub_const ( " BulkUploadErrorSummaryTableComponent::DISPLAY_THRESHOLD " , 16 )
create ( :bulk_upload_error , bulk_upload : , col : " A " , row : 1 )
end
it " does not render rows " do
result = render_inline ( component )
expect ( result ) . to have_selector ( " tbody tr " , count : 0 )
end
end
context " when there are 2 independent errors " do
context " when there are 2 independent errors " do
let! ( :error_2 ) { create ( :bulk_upload_error , bulk_upload : , col : " B " , row : 2 ) }
let! ( :error_2 ) { create ( :bulk_upload_error , bulk_upload : , col : " B " , row : 2 ) }
let! ( :error_1 ) { create ( :bulk_upload_error , bulk_upload : , col : " A " , row : 1 ) }
let! ( :error_1 ) { create ( :bulk_upload_error , bulk_upload : , col : " A " , row : 1 ) }