Skip to content

Commit dff9fd5

Browse files
committed
test 1
Signed-off-by: Julio Jimenez <julio@clickhouse.com>
1 parent 55cb6d8 commit dff9fd5

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

test/advanced.bats

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,3 +1520,57 @@ EOF
15201520
[[ "$integration_calls" == *"system.columns"* ]]
15211521
[[ "$integration_calls" == *"ALTER TABLE"* ]]
15221522
}
1523+
1524+
# ============================================================================
1525+
# TESTS FOR extract_sbom_source_reference
1526+
# ============================================================================
1527+
1528+
# Test #82: extract_sbom_source_reference finds spdx document name from GitHub SBOM
1529+
@test "extract_sbom_source_reference finds spdx document name from GitHub SBOM" {
1530+
# Create a GitHub-style SBOM with spdx:document:name
1531+
local test_sbom="$TEST_TEMP_DIR/github_sbom.json"
1532+
cat > "$test_sbom" << 'EOF'
1533+
{
1534+
"bomFormat": "CycloneDX",
1535+
"specVersion": "1.6",
1536+
"metadata": {
1537+
"timestamp": "2025-08-03T17:52:15Z",
1538+
"tools": [
1539+
{
1540+
"name": "protobom-v0.0.0-20250731140552",
1541+
"version": "613e75aeb253+dirty"
1542+
},
1543+
{
1544+
"name": "GitHub.com-Dependency",
1545+
"version": "Graph"
1546+
}
1547+
],
1548+
"properties": [
1549+
{
1550+
"name": "spdx:spdxid",
1551+
"value": "SPDXRef-DOCUMENT"
1552+
},
1553+
{
1554+
"name": "spdx:document:spdx-version",
1555+
"value": "SPDX-2.2"
1556+
},
1557+
{
1558+
"name": "spdx:document:name",
1559+
"value": "com.github.ClickHouse/clickhouse-js"
1560+
},
1561+
{
1562+
"name": "spdx:document:document-namespace",
1563+
"value": "https://spdx.org/spdxdocs/protobom/f00b0bff-1270-4c18-aae2-8c69fab0d995"
1564+
}
1565+
]
1566+
}
1567+
}
1568+
EOF
1569+
1570+
# Test the function
1571+
run extract_sbom_source_reference "$test_sbom" "fallback.json"
1572+
echo "$output"
1573+
echo "$status"
1574+
[ "$status" -eq 0 ]
1575+
[ "$output" = "com.github.ClickHouse/clickhouse-js" ]
1576+
}

0 commit comments

Comments
 (0)