mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(xml): share element-depth refusal assertions (#15759)
This commit is contained in:
1 parent
6bb42af594
commit
f31076d3ca
5 files changed
+49
-102
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { expectXmlElementDepthRefusal } from "../../tests/support/expectXmlElementDepthRefusal.js";
|
||||
import { ParseFailureError } from "../domain/parseFailure.js";
|
||||
import { createHash } from "node:crypto";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
@@ -13,10 +14,7 @@ import {
|
||||
} from "./MavenGradleMetadata.fixture.js";
|
||||
import { MavenGradleMetadataProvider } from "./MavenGradleMetadataProvider.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import {
|
||||
XML_ELEMENT_DEPTH_ALLOWANCE,
|
||||
XML_ELEMENT_DEPTH_LIMIT,
|
||||
} from "../domain/xmlDocument.js";
|
||||
import { XML_ELEMENT_DEPTH_LIMIT } from "../domain/xmlDocument.js";
|
||||
import { parseMavenGradleMetadata } from "./MavenGradleMetadataParser.js";
|
||||
|
||||
const parse = (source: string, path = "/artifacts/pom.xml") => {
|
||||
@@ -1163,27 +1161,7 @@ it("reports XML element depth from the provider instead of an I/O failure", asyn
|
||||
max_file_bytes: 1024 * 1024,
|
||||
});
|
||||
if (result.ok) throw new Error("expected the XML depth ceiling");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "resource_constraint",
|
||||
retryable: false,
|
||||
details: {
|
||||
reported_limits: {
|
||||
boundary: "xml-element-depth",
|
||||
maximum: XML_ELEMENT_DEPTH_LIMIT,
|
||||
required: XML_ELEMENT_DEPTH_LIMIT + 1,
|
||||
},
|
||||
refusal: {
|
||||
kind: "fixed_ceiling",
|
||||
allowance: XML_ELEMENT_DEPTH_ALLOWANCE.name,
|
||||
allowance_kind: "parser",
|
||||
limit: XML_ELEMENT_DEPTH_LIMIT,
|
||||
unit: "levels",
|
||||
},
|
||||
},
|
||||
remediation: {
|
||||
action: expect.stringContaining("no runtime override"),
|
||||
},
|
||||
});
|
||||
expectXmlElementDepthRefusal(result.error);
|
||||
} finally {
|
||||
await provider.close();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user