Skip to content

Commit 0de0af1

Browse files
committed
Remove unnesessary test package incrementation
1 parent 4daccf7 commit 0de0af1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

componentDetection.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe("ComponentDetection.addPackagesToManifests", () => {
7474
const manifests: any[] = [];
7575

7676
const testPackage = {
77-
id: "test-package-1",
77+
id: "test-package",
7878
packageUrl: "pkg:npm/test-package@1.0.0",
7979
isDevelopmentDependency: false,
8080
topLevelReferrers: [], // Empty array = direct dependency
@@ -100,22 +100,23 @@ describe("ComponentDetection.addPackagesToManifests", () => {
100100
const manifests: any[] = [];
101101

102102
const testPackage = {
103-
id: "test-package-2",
104-
packageUrl: "pkg:npm/test-package@2.0.0",
103+
id: "test-package",
104+
packageUrl: "pkg:npm/test-package@1.0.0",
105105
isDevelopmentDependency: false,
106106
topLevelReferrers: [{ packageUrl: "pkg:npm/parent-package@1.0.0" }], // Has referrers = indirect
107107
locationsFoundAt: ["package.json"],
108108
containerDetailIds: [],
109109
containerLayerIds: [],
110-
packageID: () => "pkg:npm/test-package@2.0.0",
111-
packageURL: { toString: () => "pkg:npm/test-package@2.0.0" }
110+
packageID: () => "pkg:npm/test-package@1.0.0",
111+
packageURL: { toString: () => "pkg:npm/test-package@1.0.0" }
112112
};
113113

114114
ComponentDetection.addPackagesToManifests([testPackage] as any, manifests);
115115

116116
expect(manifests).toHaveLength(1);
117117
expect(manifests[0].name).toBe("package.json");
118118

119+
// Test the actual manifest state - should be indirect dependency
119120
expect(manifests[0].directDependencies()).toHaveLength(0);
120121
expect(manifests[0].indirectDependencies()).toHaveLength(1);
121122
expect(manifests[0].countDependencies()).toBe(1);
@@ -125,15 +126,15 @@ describe("ComponentDetection.addPackagesToManifests", () => {
125126
const manifests: any[] = [];
126127

127128
const testPackage = {
128-
id: "test-package-3",
129-
packageUrl: "pkg:npm/test-package@3.0.0",
129+
id: "test-package",
130+
packageUrl: "pkg:npm/test-package@1.0.0",
130131
isDevelopmentDependency: false,
131-
topLevelReferrers: [{ packageUrl: "pkg:npm/test-package@3.0.0" }], // Self-reference case
132+
topLevelReferrers: [{ packageUrl: "pkg:npm/test-package@1.0.0" }], // Self-reference case
132133
locationsFoundAt: ["package.json"],
133134
containerDetailIds: [],
134135
containerLayerIds: [],
135-
packageID: () => "pkg:npm/test-package@3.0.0",
136-
packageURL: { toString: () => "pkg:npm/test-package@3.0.0" }
136+
packageID: () => "pkg:npm/test-package@1.0.0",
137+
packageURL: { toString: () => "pkg:npm/test-package@1.0.0" }
137138
};
138139

139140
ComponentDetection.addPackagesToManifests([testPackage] as any, manifests);

0 commit comments

Comments
 (0)