Skip to content

Commit a0a7d38

Browse files
committed
Clean up test for id checking
1 parent 49b54ce commit a0a7d38

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

compatibility/support/shared_examples.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@
2929
end
3030

3131
it 'ensures a consistent `testRunStartedId` across the entire test run' do
32-
# Step 1) Grab testRunStarted[:id]
33-
test_run_message = parsed_generated.detect { |msg| message_type(msg) == :test_run_started }
34-
id = test_run_message.test_run_started.id
35-
36-
# Step 2) Validate every testCase has a [:testRunStartedId] equal to the above
37-
# Step 3) Validate the single testRunFinished [:testRunStartedId] equal to the above
38-
messages_types_containing_test_run_started_id = %i[test_case test_run_finished]
39-
messages_containing_test_run_started_id = parsed_generated.select { |msg| messages_types_containing_test_run_started_id.include?(message_type(msg)) }
32+
test_run_started_id = parsed_generated.detect { |msg| message_type(msg) == :test_run_started }.test_run_started.id
33+
messages_containing_test_run_started_id = parsed_generated.select do |msg|
34+
# These two types of message are the only ones containing the testRunStartedId attribute
35+
%i[test_case test_run_finished].include?(message_type(msg))
36+
end
4037
ids = messages_containing_test_run_started_id.map { |msg| msg.send(message_type(msg)).test_run_started_id }
4138

42-
expect(ids).to all eq(id)
39+
expect(ids).to all eq(test_run_started_id)
4340
end
4441
end

0 commit comments

Comments
 (0)