Class: GitlabQuality::TestTooling::CodeCoverage::TestFileMappingData
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::CodeCoverage::TestFileMappingData
- Defined in:
- lib/gitlab_quality/test_tooling/code_coverage/test_file_mapping_data.rb
Instance Method Summary collapse
-
#as_db_table ⇒ Array<Hash<Symbol, String>>
Mapping data formatted for database insertion.
-
#initialize(test_to_sources, tests_to_categories: {}, feature_categories_to_teams: {}) ⇒ TestFileMappingData
constructor
A new instance of TestFileMappingData.
Constructor Details
#initialize(test_to_sources, tests_to_categories: {}, feature_categories_to_teams: {}) ⇒ TestFileMappingData
Returns a new instance of TestFileMappingData.
13 14 15 16 17 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/test_file_mapping_data.rb', line 13 def initialize(test_to_sources, tests_to_categories: {}, feature_categories_to_teams: {}) @test_to_sources = test_to_sources @tests_to_categories = tests_to_categories @feature_categories_to_teams = feature_categories_to_teams end |
Instance Method Details
#as_db_table ⇒ Array<Hash<Symbol, String>>
Returns Mapping data formatted for database insertion.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/test_file_mapping_data.rb', line 26 def as_db_table @test_to_sources.flat_map do |test_file, source_files| category = @tests_to_categories[test_file]&.first || '' team = @feature_categories_to_teams[category] || {} source_files.map do |source_file| { test_file: test_file, source_file: source_file, category: category, group: team[:group] || '', stage: team[:stage] || '', section: team[:section] || '' } end end end |