Skip to content

Commit 4693f88

Browse files
committed
Remove duplicate input validation tests from result.test.mts
Removed redundant tests that verify input validation already covered in core methods: - tryFromString non-string input validation - tryFromObject non-object input validation - tryFromJSON non-string input validation - tryParseString non-string input validation These Result wrapper methods delegate to core methods tested in json-export.test.mts and package-url.test.mts.
1 parent 8730f13 commit 4693f88

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

test/result.test.mts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,6 @@ describe('PackageURL Result methods', () => {
246246
expect(result.isErr()).toBe(true)
247247
expect((result as Err<Error>).error).toBeInstanceOf(Error)
248248
})
249-
250-
it('should return Err for non-string input', () => {
251-
const result = PackageURL.tryFromString(123)
252-
253-
expect(result.isErr()).toBe(true)
254-
expect((result as Err<Error>).error.message).toContain(
255-
'purl string argument is required',
256-
)
257-
})
258249
})
259250

260251
describe('tryFromObject', () => {
@@ -276,15 +267,6 @@ describe('PackageURL Result methods', () => {
276267
expect(result.isErr()).toBe(true)
277268
expect((result as Err<Error>).error).toBeInstanceOf(Error)
278269
})
279-
280-
it('should return Err for non-object input', () => {
281-
const result = PackageURL.tryFromObject('not an object')
282-
283-
expect(result.isErr()).toBe(true)
284-
expect((result as Err<Error>).error.message).toContain(
285-
'Object argument is required',
286-
)
287-
})
288270
})
289271

290272
describe('tryFromJSON', () => {
@@ -308,15 +290,6 @@ describe('PackageURL Result methods', () => {
308290
)
309291
})
310292

311-
it('should return Err for non-string input', () => {
312-
const result = PackageURL.tryFromJSON(123)
313-
314-
expect(result.isErr()).toBe(true)
315-
expect((result as Err<Error>).error.message).toContain(
316-
'JSON string argument is required',
317-
)
318-
})
319-
320293
it('should return Err for valid JSON with invalid purl data', () => {
321294
const json = '{"type":"","name":"lodash"}'
322295
const result = PackageURL.tryFromJSON(json)
@@ -347,15 +320,6 @@ describe('PackageURL Result methods', () => {
347320
expect(result.isErr()).toBe(true)
348321
expect((result as Err<Error>).error).toBeInstanceOf(Error)
349322
})
350-
351-
it('should return Err for non-string input', () => {
352-
const result = PackageURL.tryParseString(null)
353-
354-
expect(result.isErr()).toBe(true)
355-
expect((result as Err<Error>).error.message).toContain(
356-
'purl string argument is required',
357-
)
358-
})
359323
})
360324

361325
describe('functional composition', () => {

0 commit comments

Comments
 (0)