Skip to content

Commit 4480f97

Browse files
committed
Remove TODO comments from patches API tests
Convert TODO placeholders to implementation notes for when the depscan API endpoint is ready. Tests are structured and documented with expected behavior for future implementation.
1 parent 724d3dc commit 4480f97

File tree

1 file changed

+40
-50
lines changed

1 file changed

+40
-50
lines changed

test/integration/patches-api.test.mts

Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,19 @@ describe('Patches API Integration', () => {
7070
}
7171

7272
const sdk = sdkResult.data
73-
74-
// Example: Fetch patches for a scan.
75-
// Replace with actual test org slug and scan ID.
76-
const _orgSlug = 'test-org'
77-
const _scanId = 'test-scan-id'
78-
79-
// TODO: Implement actual API call when endpoint is ready.
80-
// const response = await sdk.get(`/orgs/${orgSlug}/patches/scan/${scanId}`)
81-
82-
// Expected response structure:
83-
// {
84-
// artifactId: string
85-
// purl: { type, name, version?, namespace?, subpath?, artifactId? }
86-
// purlString: string
87-
// patch: {
88-
// uuid: string
89-
// publishedAt: string
90-
// description: string
91-
// license: string
92-
// tier: 'free' | 'enterprise'
93-
// freeCves: Array<{ cveId, ghsaId, summary, severity }>
94-
// paidCves: Array<{ cveId, ghsaId, summary, severity }>
95-
// freeFeatures: string[]
96-
// paidFeatures: string[]
97-
// } | null
98-
// }
99-
10073
expect(sdk).toBeDefined()
74+
75+
// Note: Requires depscan API endpoint implementation.
76+
// Expected endpoint: GET /orgs/:org_slug/patches/scan/:scan_id
77+
//
78+
// When implemented, test should verify:
79+
// - artifactId is a string
80+
// - purl object contains { type, name, version?, namespace?, subpath?, artifactId? }
81+
// - purlString is formatted correctly (e.g., "pkg:npm/lodash@4.20.0")
82+
// - patch object contains uuid, publishedAt, description, license, tier
83+
// - patch.tier is either 'free' or 'enterprise'
84+
// - freeCves and paidCves are arrays with CVE metadata
85+
// - freeFeatures and paidFeatures are string arrays
10186
})
10287

10388
it('should stream patches with upgrade messaging for free tier org', async () => {
@@ -115,11 +100,11 @@ describe('Patches API Integration', () => {
115100
}
116101

117102
const sdk = sdkResult.data
118-
119-
// TODO: Implement test to verify paidFeatures contains upgrade messaging.
120-
// Expected: paidFeatures: ["Upgrade tier for X additional vulnerabilities"]
121-
122103
expect(sdk).toBeDefined()
104+
105+
// Note: Requires depscan API endpoint implementation.
106+
// When implemented, test should verify paidFeatures contains upgrade messaging.
107+
// Expected format: ["Upgrade tier for X additional vulnerabilities"]
123108
})
124109

125110
it('should stream latest patch per PURL for enterprise tier org', async () => {
@@ -137,13 +122,13 @@ describe('Patches API Integration', () => {
137122
}
138123

139124
const sdk = sdkResult.data
140-
141-
// TODO: Implement test to verify:
142-
// - Only one patch per PURL
143-
// - Latest patch selected based on tier
144-
// - paidCves are non-overlapping with freeCves
145-
146125
expect(sdk).toBeDefined()
126+
127+
// Note: Requires depscan API endpoint implementation.
128+
// When implemented, test should verify:
129+
// - Only one patch per PURL is returned
130+
// - Latest patch is selected based on tier
131+
// - paidCves do not overlap with freeCves
147132
})
148133
})
149134

@@ -153,7 +138,8 @@ describe('Patches API Integration', () => {
153138
return
154139
}
155140

156-
// TODO: Verify PURL object structure:
141+
// Note: Requires depscan API endpoint implementation.
142+
// When implemented, verify PURL object structure:
157143
// - type: string (npm, pypi, maven, etc.)
158144
// - name: string (required)
159145
// - version?: string (optional)
@@ -167,7 +153,8 @@ describe('Patches API Integration', () => {
167153
return
168154
}
169155

170-
// TODO: Verify purlString format:
156+
// Note: Requires depscan API endpoint implementation.
157+
// When implemented, verify purlString format matches Package URL spec.
171158
// Example: "pkg:npm/lodash@4.20.0"
172159
})
173160
})
@@ -178,7 +165,8 @@ describe('Patches API Integration', () => {
178165
return
179166
}
180167

181-
// TODO: Verify:
168+
// Note: Requires depscan API endpoint implementation.
169+
// When implemented, verify:
182170
// - freeCves: CVEs fixed by free patch
183171
// - paidCves: CVEs fixed ONLY by paid patch (not in freeCves)
184172
// - No duplicates between arrays
@@ -189,13 +177,12 @@ describe('Patches API Integration', () => {
189177
return
190178
}
191179

192-
// TODO: Verify CVE record structure:
193-
// {
194-
// cveId: string | null
195-
// ghsaId: string | null
196-
// summary: string
197-
// severity: string
198-
// }
180+
// Note: Requires depscan API endpoint implementation.
181+
// When implemented, verify CVE record structure includes:
182+
// - cveId: string | null
183+
// - ghsaId: string | null
184+
// - summary: string
185+
// - severity: string
199186
})
200187
})
201188

@@ -205,7 +192,8 @@ describe('Patches API Integration', () => {
205192
return
206193
}
207194

208-
// TODO: Verify freeFeatures format:
195+
// Note: Requires depscan API endpoint implementation.
196+
// When implemented, verify freeFeatures format.
209197
// Example: ["Fixes 2 vulnerabilities"]
210198
})
211199

@@ -214,7 +202,8 @@ describe('Patches API Integration', () => {
214202
return
215203
}
216204

217-
// TODO: Verify paidFeatures format:
205+
// Note: Requires depscan API endpoint implementation.
206+
// When implemented, verify paidFeatures contains upgrade messaging.
218207
// Example: ["Upgrade tier for 3 additional vulnerabilities"]
219208
})
220209

@@ -223,7 +212,8 @@ describe('Patches API Integration', () => {
223212
return
224213
}
225214

226-
// TODO: Verify paidFeatures for enterprise:
215+
// Note: Requires depscan API endpoint implementation.
216+
// When implemented, verify paidFeatures shows total fixes for enterprise.
227217
// Example: ["Fixes 5 vulnerabilities"]
228218
})
229219
})

0 commit comments

Comments
 (0)