Skip to content

Commit

Permalink
fix: add percent-encoded plus sign in purl version tests (#4939)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-agabani-snyk committed Nov 21, 2023
1 parent 4eb072f commit d2f00f2
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/jest/unit/snyk-dep-graph.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { createFromJSON } from '@snyk/dep-graph';

describe('@snyk/dep-graph', () => {
describe('createFromJSON', () => {
it('supports percent-encoded plus sign in purl version', () => {
// Arrange
const json = {
schemaVersion: '1.3.0',
pkgManager: {
name: 'deb',
repositories: [
{
alias: 'repository:tag',
},
],
},
pkgs: [
{
id: 'repository@digest',
info: {
name: 'repository',
version: 'digest',
},
},
{
id: 'db5.3/libdb5.3@5.3.28+dfsg1-0.6ubuntu2',
info: {
name: 'db5.3/libdb5.3',
version: '5.3.28+dfsg1-0.6ubuntu2',
purl: 'pkg:deb/libdb5.3@5.3.28%2Bdfsg1-0.6ubuntu2?upstream=db5.3',
},
},
],
graph: {
rootNodeId: 'root-node',
nodes: [
{
nodeId: 'root-node',
pkgId: 'repository@digest',
deps: [
{
nodeId: 'db5.3/libdb5.3@5.3.28+dfsg1-0.6ubuntu2',
},
],
},
{
nodeId: 'db5.3/libdb5.3@5.3.28+dfsg1-0.6ubuntu2',
pkgId: 'db5.3/libdb5.3@5.3.28+dfsg1-0.6ubuntu2',
deps: [],
},
],
},
};

// Act
createFromJSON(json);
});
});
});

0 comments on commit d2f00f2

Please sign in to comment.