refactor(managed): derive inspection from PE CLI extents
This commit is contained in:
@@ -5,16 +5,14 @@ import {
|
||||
buildManagedPeFixture,
|
||||
buildNativePeFixture,
|
||||
managedPeFixtureTarget,
|
||||
MANAGED_ARTIFACT_FIXTURE_LIMITS,
|
||||
} from "./ManagedPe.fixture.js";
|
||||
|
||||
describe("managed artifact failure classification", () => {
|
||||
it("distinguishes native, malformed, unsupported, and bounded metadata", () => {
|
||||
it("distinguishes native, malformed, and unsupported metadata", () => {
|
||||
const nativeBytes = buildNativePeFixture();
|
||||
const native = inspectManagedArtifactBytes(
|
||||
nativeBytes,
|
||||
managedPeFixtureTarget(nativeBytes),
|
||||
MANAGED_ARTIFACT_FIXTURE_LIMITS,
|
||||
);
|
||||
expect(native).toMatchObject({
|
||||
classification: { status: "not-managed" },
|
||||
@@ -28,7 +26,6 @@ describe("managed artifact failure classification", () => {
|
||||
const malformed = inspectManagedArtifactBytes(
|
||||
malformedBytes,
|
||||
managedPeFixtureTarget(malformedBytes),
|
||||
MANAGED_ARTIFACT_FIXTURE_LIMITS,
|
||||
);
|
||||
expect(malformed.classification.status).toBe("malformed");
|
||||
expect(malformed.coverage.issues).toEqual([
|
||||
@@ -41,21 +38,9 @@ describe("managed artifact failure classification", () => {
|
||||
const unsupportedTable = inspectManagedArtifactBytes(
|
||||
unsupportedTableBytes,
|
||||
managedPeFixtureTarget(unsupportedTableBytes),
|
||||
MANAGED_ARTIFACT_FIXTURE_LIMITS,
|
||||
);
|
||||
expect(unsupportedTable.coverage.issues).toEqual([
|
||||
expect.objectContaining({ code: "invalid-tables" }),
|
||||
]);
|
||||
|
||||
const limitedBytes = buildManagedPeFixture();
|
||||
const limited = inspectManagedArtifactBytes(
|
||||
limitedBytes,
|
||||
managedPeFixtureTarget(limitedBytes),
|
||||
{ ...MANAGED_ARTIFACT_FIXTURE_LIMITS, maxMetadataBytes: 256 },
|
||||
);
|
||||
expect(limited.metadata.status).toBe("partial");
|
||||
expect(limited.coverage.issues).toEqual([
|
||||
expect.objectContaining({ code: "limit-exceeded" }),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user