test(cli): align reference import failure envelopes

Expect ok:false and the preserved error payload in full-output mode, including Windows unsupported-host failures. Retain plain JSON, selected-path, remediation, permission, logging, and source-preservation coverage.

Validation: focused compiled CLI output and reference-import tests; Windows-only cases await CI.
This commit is contained in:
morluto
2026-10-13 04:24:34 +08:00
parent ac57c88efe
commit 8224aeba9d
@@ -47,8 +47,8 @@ describe("compiled Windows reference-source import", () => {
expect(result.json).toEqual( expect(result.json).toEqual(
scenario.fullOutput scenario.fullOutput
? expect.objectContaining({ ? expect.objectContaining({
ok: true, ok: false,
data: unsupportedHostOutput, error: unsupportedHostOutput,
}) })
: unsupportedHostOutput, : unsupportedHostOutput,
); );
@@ -113,16 +113,14 @@ describe("compiled reference-source import preflight failures", () => {
message: expect.stringContaining(rootReason), message: expect.stringContaining(rootReason),
}; };
if (scenario.fullOutput) { if (scenario.fullOutput) {
// Incur's legacy wrapper remains unchanged; operation status is
// conveyed by the exit code and command log, not this `ok` field.
expect(result.json).toMatchObject({ expect(result.json).toMatchObject({
ok: true, ok: false,
data: invalidRootOutput, error: invalidRootOutput,
}); });
} else { } else {
expect(result.json).toMatchObject(invalidRootOutput); expect(result.json).toMatchObject(invalidRootOutput);
} }
const messagePath = scenario.fullOutput ? "data.message" : "message"; const messagePath = scenario.fullOutput ? "error.message" : "message";
expect(result.json).toHaveProperty( expect(result.json).toHaveProperty(
messagePath, messagePath,
expect.stringContaining( expect.stringContaining(