File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1666,12 +1666,33 @@ EOF
16661666 }
16671667 }
16681668}
1669+ EOF
1670+
1671+ # Test the function
1672+ run extract_sbom_source_reference " $test_sbom " " fallback.json"
1673+ [ " $status " -eq 0 ]
1674+ [ " $output " = " 5ee38db1-6bec-449c-9908-070b77ac10db" ]
1675+ }
1676+
1677+ # Test #86: extract_sbom_source_reference finds top-level name field
1678+ @test " extract_sbom_source_reference finds top-level name field" {
1679+ # Create a SBOM with top-level name
1680+ local test_sbom=" $TEST_TEMP_DIR /toplevel_name_sbom.json"
1681+ cat > " $test_sbom " << 'EOF '
1682+ {
1683+ "bomFormat": "CycloneDX",
1684+ "specVersion": "1.6",
1685+ "name": "my-project-sbom",
1686+ "metadata": {
1687+ "timestamp": "2025-08-03T17:52:15Z"
1688+ }
1689+ }
16691690EOF
16701691
16711692 # Test the function
16721693 run extract_sbom_source_reference " $test_sbom " " fallback.json"
16731694 echo " $output "
16741695 echo " $status "
16751696 [ " $status " -eq 0 ]
1676- [ " $output " = " 5ee38db1-6bec-449c-9908-070b77ac10db " ]
1697+ [ " $output " = " my-project-sbom " ]
16771698}
You can’t perform that action at this time.
0 commit comments