Skip to content

Commit

Permalink
fix: gracefully handle contracts without interactions or messages in …
Browse files Browse the repository at this point in the history
…deployment status warnings
  • Loading branch information
bethesque committed Aug 6, 2020
1 parent 4f18452 commit 6c223e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pact_broker/pacts/content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def sort
end

def interactions_missing_test_results
interactions.reject do | interaction |
return [] unless messages_or_interactions
messages_or_interactions.reject do | interaction |
interaction['tests']&.any?
end
end
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/pact_broker/pacts/content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ module Pacts
expect(subject.interactions_missing_test_results.count).to eq 1
end

context "with no interactions" do
let(:pact_content) { {} }

it "does not blow up" do
expect(subject.interactions_missing_test_results.count).to eq 0
end
end

context "with nil test results" do
let(:test_results) { nil }

Expand Down

0 comments on commit 6c223e6

Please sign in to comment.