'use strict'; // Test-only transport boundary. This file does not emulate any CLI transformation. const fs = require('node:fs'); const path = require('node:path'); const cp = require('node:child_process'); const marker = 'RA3_CLI_TEST_RAW_XML_ENVELOPE\n'; cp.execFileSync = function fakeConverter(file, args) { const command = path.basename(file).replace(/\.exe$/i, '').toLowerCase(); if (!['apt2xml', 'xml2apt'].includes(command) || args.length !== 1) { throw new Error('The test transport permits only apt2xml/xml2apt with one base path'); } const base = args[0]; if (command === 'apt2xml') { const envelope = fs.readFileSync(base + '.apt', 'utf8'); if (!envelope.startsWith(marker)) { throw new Error('The simulated converter refuses real APT binaries'); } fs.writeFileSync(base + '.xml', envelope.slice(marker.length)); } else { // Keep the .const that production build() wrote; do not supply a fake one. fs.writeFileSync(base + '.apt', marker + fs.readFileSync(base + '.xml', 'utf8')); } return Buffer.alloc(0); };