Class: FeatureMap::Private::TestPyramid::JestMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_map/private/test_pyramid/jest_mapper.rb

Class Method Summary collapse

Class Method Details

.map_tests_by_assignment(test_suites, assignments) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/feature_map/private/test_pyramid/jest_mapper.rb', line 6

def map_tests_by_assignment(test_suites, assignments)
  # Transform test suites into a hash of filepath => assertion results
  tests_by_path = test_suites.each_with_object({}) do |suite, result|
    result[filepath(suite['name'])] = suite['assertionResults']
  end

  assignments.each_with_object({}) do |(feature_name, files), result|
    counts = count_tests_for_feature(tests_by_path, files)
    result[feature_name] = counts
  end
end