diff --git a/src/native/windows/WindowsShortcutParser.test.ts b/src/native/windows/WindowsShortcutParser.test.ts index 00ed07af07..2befdf7586 100644 --- a/src/native/windows/WindowsShortcutParser.test.ts +++ b/src/native/windows/WindowsShortcutParser.test.ts @@ -460,9 +460,16 @@ it("reports truncated StringData as partial coverage with a failing offset", asy expect(windowsShortcutSchema.safeParse(report).success).toBe(true); }); -it.each([12, 16, 20, 24, 28, 32])( +it.each([ + [12, "truncated"], + [16, "malformed_structure"], + [20, "truncated"], + [24, "malformed_structure"], + [28, "malformed_structure"], + [32, "malformed_structure"], +] as const)( "points an out-of-range LinkInfo offset at its field at byte %i", - async (field) => { + async (field, code) => { const bytes = windowsShortcutBytes({ idList: null, linkInfo: { @@ -474,6 +481,9 @@ it.each([12, 16, 20, 24, 28, 32])( const report = await parse(bytes); expect(report.coverage.status).toBe("partial"); expect(report.coverage.failing_offset).toBe(76 + field); + expect(report.issues).toContainEqual( + expect.objectContaining({ code, offset: 76 + field }), + ); expect(report.issues.every((issue) => issue.offset < bytes.length)).toBe( true, ); diff --git a/tests/boundary/filesystem/directoryRootIdentity.test.ts b/tests/boundary/filesystem/directoryRootIdentity.test.ts index f641f6d9e1..071d26f40b 100644 --- a/tests/boundary/filesystem/directoryRootIdentity.test.ts +++ b/tests/boundary/filesystem/directoryRootIdentity.test.ts @@ -66,7 +66,38 @@ it("discards unverified desktop byte facts when the admitted root changes during const original = join(root, "original"); const moved = join(root, "moved"); await mkdir(original); - await writeFile(join(original, "sample.exe"), Buffer.from("MZ")); + const library = "GameAssembly.dll"; + await writeFile( + join(original, library), + Buffer.from([0x7f, 0x45, 0x4c, 0x46]), + ); + const pathFact = { + kind: "il2cpp-library-convention", + offset: null, + value: library, + }; + const baseline = new DesktopApplicationService( + new DesktopApplicationReader(), + ); + try { + const inspected = await baseline.inspect({ path: original }); + if (!inspected.ok) throw inspected.error; + const report = desktopApplicationSchema.parse( + inspected.value.normalized_result, + ); + expect(report.files).toMatchObject([ + { + path: library, + ranges: [{ offset: 0, bytes: 4 }], + facts: [ + pathFact, + { kind: "native-image-header", offset: 0, value: { format: "elf" } }, + ], + }, + ]); + } finally { + await baseline.close(); + } const service = new DesktopApplicationService( new DesktopApplicationReader((path) => { const reader = new DirectoryArtifactReader(path); @@ -98,13 +129,11 @@ it("discards unverified desktop byte facts when the admitted root changes during expect(report.root.path).toBe(original); expect(report.files).toHaveLength(1); expect(report.files[0]).toMatchObject({ - path: "sample.exe", + path: library, read_status: "unavailable", ranges: [], + facts: [pathFact], }); - expect(report.files[0]?.facts.every((fact) => fact.offset === null)).toBe( - true, - ); expect(report.coverage.status).toBe("partial"); } finally { await service.close(); diff --git a/tests/evaluation/optionalFactDefaultGuard.test.ts b/tests/evaluation/optionalFactDefaultGuard.test.ts index ca24ffb03b..bb1b9b7fd0 100644 --- a/tests/evaluation/optionalFactDefaultGuard.test.ts +++ b/tests/evaluation/optionalFactDefaultGuard.test.ts @@ -1,4 +1,3 @@ -import { readFile } from "node:fs/promises"; import { expect, it } from "vitest"; import { isComparisonOrCountFile, @@ -229,17 +228,6 @@ it("exempts a default whose operand starts on an earlier line", () => { ).toBe(1); }); -it("loads without installed dependencies, as CI runs it before npm ci", async () => { - const source = await readFile( - new URL( - "../../scripts/verify/optional-fact-default-guard.mjs", - import.meta.url, - ), - "utf8", - ); - expect(source).not.toMatch(/\bfrom\s+["'](?!node:|\.)/u); -}); - it("selects comparison, coverage and count files only", () => { expect(isComparisonOrCountFile("src/domain/artifactComparison.ts")).toBe( true, diff --git a/tests/evaluation/reasonMarker.test.ts b/tests/evaluation/reasonMarker.test.ts index 39f76b13a4..bafc3b8765 100644 --- a/tests/evaluation/reasonMarker.test.ts +++ b/tests/evaluation/reasonMarker.test.ts @@ -1,4 +1,3 @@ -import { readFile } from "node:fs/promises"; import { expect, it } from "vitest"; import { unmarkedMatchCount } from "../../scripts/verify/reason-marker.mjs"; @@ -97,13 +96,3 @@ it("reads a regular expression after a control head as a statement", () => { 0, ); }); - -it("loads without installed dependencies, as CI runs it before npm ci", async () => { - for (const module of ["reason-marker.mjs", "source-tokens.mjs"]) { - const source = await readFile( - new URL(`../../scripts/verify/${module}`, import.meta.url), - "utf8", - ); - expect(source).not.toMatch(/\bfrom\s+["'](?!node:|\.)/u); - } -});