fix: improve trans script migration hint
This commit is contained in:
@@ -74,3 +74,38 @@ describe("ssh stdout bounded streaming", () => {
|
||||
expect(hint).toContain("\"transport\":\"frontend-websocket\"");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ssh removed shell aliases", () => {
|
||||
test("reports route-aware replacement examples for trans script", () => {
|
||||
const previousEntrypoint = process.env.UNIDESK_SSH_ENTRYPOINT;
|
||||
process.env.UNIDESK_SSH_ENTRYPOINT = "trans";
|
||||
try {
|
||||
parseSshInvocation("D601:/tmp", ["script", "--", "pwd"]);
|
||||
throw new Error("expected script alias to fail");
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
const payload = error as Error & {
|
||||
code?: string;
|
||||
entrypoint?: string;
|
||||
route?: string;
|
||||
operation?: string;
|
||||
replacementExamples?: {
|
||||
posixSh?: string;
|
||||
bash?: string;
|
||||
};
|
||||
};
|
||||
expect(payload.code).toBe("ssh-removed-shell-alias");
|
||||
expect(payload.entrypoint).toBe("trans");
|
||||
expect(payload.route).toBe("D601:/tmp");
|
||||
expect(payload.operation).toBe("script");
|
||||
expect(payload.replacementExamples?.posixSh).toBe("trans D601:/tmp sh -- 'pwd'");
|
||||
expect(payload.replacementExamples?.bash).toBe("trans D601:/tmp bash -- 'pwd'");
|
||||
} finally {
|
||||
if (previousEntrypoint === undefined) {
|
||||
delete process.env.UNIDESK_SSH_ENTRYPOINT;
|
||||
} else {
|
||||
process.env.UNIDESK_SSH_ENTRYPOINT = previousEntrypoint;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user