Skip to content

Commit

Permalink
Merge branch 'main' into FI-3261-markdown-descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyssaWang authored Dec 10, 2024
2 parents ccdbb9c + 40b6c5c commit 05143ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/inferno/result_summarizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def initialize(results)
end

def summarize
return 'wait' if results.any? { |result| result.result == 'wait' }

return 'pass' if optional_results_passing_criteria_met?

prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string }
Expand Down
8 changes: 8 additions & 0 deletions spec/inferno/result_summarizer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
RSpec.describe Inferno::ResultSummarizer do
let(:passing_result) { repo_create(:result, result: 'pass') }
let(:failing_result) { repo_create(:result, result: 'fail') }
let(:waiting_result) { repo_create(:result, result: 'wait') }

context 'when all results are required' do
it 'returns the highest priority result' do
Expand All @@ -29,5 +30,12 @@

expect(result).to eq('pass')
end

it 'returns "wait" if an optional result is waiting' do
allow(waiting_result).to receive(:optional?).and_return(true)
result = described_class.new([passing_result, waiting_result]).summarize

expect(result).to eq('wait')
end
end
end

0 comments on commit 05143ce

Please sign in to comment.