Skip to content

Commit 1f6a51a

Browse files
committed
Add type checking compatibility fixes for test files
1 parent 2f8904a commit 1f6a51a

File tree

4 files changed

+148
-75
lines changed

4 files changed

+148
-75
lines changed

test/benchmark.test.mts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ describe('PackageURL', () => {
3737
}
3838
const start = Date.now()
3939
for (let i = 0; i < iterations; i += 1) {
40-
const obj = objects[i]
41-
const expected_output = obj?.['expected_output']
40+
const obj = objects[i] as Record<string, unknown>
41+
const expected_output = obj['expected_output']
4242
if (isObject(expected_output)) {
4343
const purl = new PackageURL(
44-
expected_output.type,
45-
expected_output.namespace,
46-
expected_output.name,
47-
expected_output.version,
48-
expected_output.qualifiers,
49-
expected_output.subpath,
44+
expected_output['type'] as string,
45+
expected_output['namespace'] as string | undefined,
46+
expected_output['name'] as string,
47+
expected_output['version'] as string | undefined,
48+
expected_output['qualifiers'] as Record<string, string> | undefined,
49+
expected_output['subpath'] as string | undefined,
5050
)
5151
PackageURL.fromString(purl.toString())
5252
}

test/json-export.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ describe('PackageURL JSON/dict export', () => {
9595
)
9696
const obj = purl.toObject()
9797

98-
expect(obj.qualifiers).toEqual(qualifiers)
98+
expect(obj['qualifiers']).toEqual(qualifiers)
9999
// Should be a copy, not the same reference
100-
expect(obj.qualifiers).not.toBe(qualifiers)
100+
expect(obj['qualifiers']).not.toBe(qualifiers)
101101
})
102102
})
103103

0 commit comments

Comments
 (0)