From dac544be20d1bdf59719dc2af450d1d0507c4d2b Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:59:27 +0800 Subject: [PATCH] test(managed): assert large issue retention without full-array diffs --- src/dotnet/ManagedArtifactFailures.test.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dotnet/ManagedArtifactFailures.test.ts b/src/dotnet/ManagedArtifactFailures.test.ts index 68a6247904..f893845e23 100644 --- a/src/dotnet/ManagedArtifactFailures.test.ts +++ b/src/dotnet/ManagedArtifactFailures.test.ts @@ -19,11 +19,12 @@ it("preserves a readable native declaration when inventory issue count exceeds c offset: 0, detail: "Controlled invalid constructor", }; + const issueCount = 150_000; const producer = vi .spyOn(inventoryProducer, "readManagedMetadataInventory") .mockImplementation((...args) => ({ ...original(...args), - issues: Array.from({ length: 150_000 }, () => issue), + issues: Array.from({ length: issueCount }, () => issue), })); try { const bytes = buildManagedPeFixture({ @@ -35,10 +36,16 @@ it("preserves a readable native declaration when inventory issue count exceeds c managedPeFixtureTarget(bytes), ); expect(result.pinvoke_imports[0]?.import_name).toBe("Observe"); - expect(result.coverage).toMatchObject({ - state: "partial", - issues: [issue], - }); + expect(result.coverage.state).toBe("partial"); + expect(result.coverage.issues.length).toBeGreaterThanOrEqual(issueCount); + expect( + result.coverage.issues.reduce( + (count, observed) => count + Number(observed.scope === issue.scope), + 0, + ), + ).toBe(issueCount); + expect(result.coverage.issues[0]).toEqual(issue); + expect(result.coverage.issues[issueCount - 1]).toEqual(issue); } finally { producer.mockRestore(); }