mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 11:33:10 +00:00
35 lines
1007 B
TypeScript
35 lines
1007 B
TypeScript
import { expect } from "vitest";
|
|
import { projectAnalysisError } from "../../src/domain/analysisErrorProjection.js";
|
|
import {
|
|
XML_ELEMENT_DEPTH_ALLOWANCE,
|
|
XML_ELEMENT_DEPTH_LIMIT,
|
|
} from "../../src/domain/xmlDocument.js";
|
|
|
|
export const expectXmlElementDepthRefusal = (
|
|
error: Parameters<typeof projectAnalysisError>[0],
|
|
reason?: string,
|
|
): void => {
|
|
expect(projectAnalysisError(error)).toMatchObject({
|
|
code: "resource_constraint",
|
|
retryable: false,
|
|
details: {
|
|
...(reason === undefined ? {} : { reason }),
|
|
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"),
|
|
},
|
|
});
|
|
};
|