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[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"), }, }); };