Skip to content

Commit 7a8672a

Browse files
committed
Fix integration test import and add missing periods to error messages
1 parent 745d5c8 commit 7a8672a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/package-url.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class PackageURL {
254254
*/
255255
static fromJSON(json: unknown): PackageURL {
256256
if (typeof json !== 'string') {
257-
throw new Error('JSON string argument is required')
257+
throw new Error('JSON string argument is required.')
258258
}
259259

260260
// Size limit: 1MB to prevent memory exhaustion.
@@ -269,12 +269,12 @@ class PackageURL {
269269
try {
270270
parsed = JSON.parse(json)
271271
} catch (e) {
272-
throw new Error('Invalid JSON string', { cause: e })
272+
throw new Error('Invalid JSON string.', { cause: e })
273273
}
274274

275275
// Validate parsed result is an object.
276276
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
277-
throw new Error('JSON must parse to an object')
277+
throw new Error('JSON must parse to an object.')
278278
}
279279

280280
// Create a safe object without prototype chain to prevent prototype pollution.
@@ -296,7 +296,7 @@ class PackageURL {
296296
*/
297297
static fromObject(obj: unknown): PackageURL {
298298
if (!isObject(obj)) {
299-
throw new Error('Object argument is required')
299+
throw new Error('Object argument is required.')
300300
}
301301
const typedObj = obj as Record<string, unknown>
302302
return new PackageURL(

test/integration.test.mts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ describe('Integration tests', () => {
6464
it('should have all entry points working together', async () => {
6565
const { pkgPath } = await isolatePackage(packagePath)
6666

67-
const { PackageURL, PackageURLBuilder } = await import(
68-
`${pkgPath}/dist/package-url.js`
69-
)
67+
const { PackageURL } = await import(`${pkgPath}/dist/package-url.js`)
68+
const { PackageURLBuilder } = await import(`${pkgPath}/dist/index.js`)
7069
const { UrlConverter } = await import(`${pkgPath}/dist/url-converter.js`)
7170

7271
// Build a purl

0 commit comments

Comments
 (0)