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
1 changed files with 5 additions and 7 deletions

View File

@ -47,8 +47,8 @@ describe("compiled Windows reference-source import", () => {
expect(result.json).toEqual(
scenario.fullOutput
? expect.objectContaining({
ok: true,
data: unsupportedHostOutput,
ok: false,
error: unsupportedHostOutput,
})
: unsupportedHostOutput,
);
@ -113,16 +113,14 @@ describe("compiled reference-source import preflight failures", () => {
message: expect.stringContaining(rootReason),
};
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({
ok: true,
data: invalidRootOutput,
ok: false,
error: invalidRootOutput,
});
} else {
expect(result.json).toMatchObject(invalidRootOutput);
}
const messagePath = scenario.fullOutput ? "data.message" : "message";
const messagePath = scenario.fullOutput ? "error.message" : "message";
expect(result.json).toHaveProperty(
messagePath,
expect.stringContaining(