Skip to content

Commit bb4a58f

Browse files
committed
sorting lines for expectation
1 parent 1dcfe77 commit bb4a58f

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

test/lib/rails_stats/json_formatter_test.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,26 @@
260260
calculator = RailsStats::StatsCalculator.new(root_directory)
261261
formatter = RailsStats::JSONFormatter.new(calculator)
262262

263-
sorted_expectation = JSON.parse(JSON_STRING)
264-
sorted_result = formatter.result
263+
expectation = JSON.parse(JSON_STRING)
264+
result = formatter.result
265265

266-
sorted_expectation.each_with_index do |x, i|
267-
assert_equal x, sorted_result[i]
266+
expectation.each do |hash|
267+
if hash["gems"]
268+
hash["gems"].each do |gem|
269+
gem["transitive_dependencies"]&.sort!
270+
end
271+
end
268272
end
273+
274+
result.each do |hash|
275+
if hash["gems"]
276+
hash["gems"].each do |gem|
277+
gem["transitive_dependencies"]&.sort!
278+
end
279+
end
280+
end
281+
282+
assert_equal expectation, result
269283
end
270284
end
271285
end

0 commit comments

Comments
 (0)