diff options
Diffstat (limited to 'spec/factories/ci/reports/sbom/sources.rb')
-rw-r--r-- | spec/factories/ci/reports/sbom/sources.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/factories/ci/reports/sbom/sources.rb b/spec/factories/ci/reports/sbom/sources.rb new file mode 100644 index 00000000000..9093aba86a6 --- /dev/null +++ b/spec/factories/ci/reports/sbom/sources.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :ci_reports_sbom_source, class: '::Gitlab::Ci::Reports::Sbom::Source' do + type { :dependency_scanning } + + transient do + sequence(:input_file_path) { |n| "subproject-#{n}/package-lock.json" } + sequence(:source_file_path) { |n| "subproject-#{n}/package.json" } + end + + data do + { + 'category' => 'development', + 'input_file' => { 'path' => input_file_path }, + 'source_file' => { 'path' => source_file_path }, + 'package_manager' => { 'name' => 'npm' }, + 'language' => { 'name' => 'JavaScript' } + } + end + + fingerprint { Digest::SHA256.hexdigest(data.to_json) } + + skip_create + + initialize_with do + ::Gitlab::Ci::Reports::Sbom::Source.new( + type: type, + data: data, + fingerprint: fingerprint + ) + end + end +end |