Skip to content

Commit 98dee3d

Browse files
committed
Fixed test
1 parent a67db56 commit 98dee3d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/test-branch-search.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ async function main() {
2121
];
2222
const diffChanges = [
2323
{ changeType: 'added', name: 'lodash', ecosystem: 'npm', purl: 'pkg:npm/[email protected]', version: '4.17.21' },
24-
{ changeType: 'updated', name: 'react', ecosystem: 'npm', purl: 'pkg:npm/[email protected]', version: '18.2.0' }
24+
{ changeType: 'updated', name: 'react', ecosystem: 'npm', purl: 'pkg:npm/[email protected]', version: '18.3.0' },
25+
{ changeType: 'removed', name: 'chalk', ecosystem: 'npm', purl: 'pkg:npm/[email protected]', version: '5.6.1' },
26+
{ changeType: 'removed', name: 'react', ecosystem: 'npm', purl: 'pkg:npm/[email protected]', version: '18.2.0' }
2527
];
2628

27-
const synthetic: RepositorySbom = {
29+
const synthetic = {
2830
repo: `${org}/${repo}`,
29-
org,
31+
org: org,
3032
retrievedAt: new Date().toISOString(),
3133
packages: basePackages,
32-
// Use Map keyed by branch name per updated type
33-
branchDiffs: new Map<string, any>([
34-
[
35-
'feature-x',
34+
branchDiffs: [
3635
{
3736
latestCommitDate: new Date().toISOString(),
3837
base: 'main',
@@ -41,8 +40,7 @@ async function main() {
4140
changes: diffChanges
4241
}
4342
]
44-
])
45-
} as RepositorySbom;
43+
};
4644

4745
fs.writeFileSync(path.join(repoDir, 'sbom.json'), JSON.stringify(synthetic, null, 2), 'utf8');
4846

@@ -57,9 +55,12 @@ async function main() {
5755

5856
const queries = [
5957
'pkg:npm/react@>=18.2.0 <19.0.0', // should match base & branch updated version
60-
'pkg:npm/[email protected]', // should match added in branch diff & branch SBOM
58+
'pkg:npm/[email protected]', // should match added in branch diff
6159
'pkg:npm/[email protected]' // base only
6260
];
61+
62+
console.debug(JSON.stringify(collector.getAllSboms()));
63+
6364
const results = collector.searchByPurlsWithReasons(queries);
6465

6566
if (!results.size) {

0 commit comments

Comments
 (0)