Skip to content

Commit 8516713

Browse files
authored
test: drop as any from patchloomNeedsUpgrade unit tests (#193)
Use typed minimal PatchloomStatus objects so tests exercise real fields instead of bypassing TypeScript with casts. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 65c23de commit 8516713

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/unit/binary.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,11 @@ test("describePatchloomCompatibility maps all compatibility levels to labels", (
753753
// --- patchloomNeedsUpgrade tests ---
754754

755755
test("patchloomNeedsUpgrade returns true only for unsupported compatibility", () => {
756-
assert.equal(patchloomNeedsUpgrade({ compatibility: "unsupported" } as any), true);
757-
assert.equal(patchloomNeedsUpgrade({ compatibility: "supported" } as any), false);
758-
assert.equal(patchloomNeedsUpgrade({ compatibility: "unknown" } as any), false);
759-
assert.equal(patchloomNeedsUpgrade({ compatibility: undefined } as any), false);
756+
const base = { ready: false, source: "missing" as const, message: "test" };
757+
assert.equal(patchloomNeedsUpgrade({ ...base, compatibility: "unsupported" }), true);
758+
assert.equal(patchloomNeedsUpgrade({ ...base, compatibility: "supported" }), false);
759+
assert.equal(patchloomNeedsUpgrade({ ...base, compatibility: "unknown" }), false);
760+
assert.equal(patchloomNeedsUpgrade({ ...base, compatibility: undefined }), false);
760761
});
761762

762763
// --- isTrustedManagedInstallDownloadUrl tests ---

0 commit comments

Comments
 (0)