chore: commit pending cli/web test tweaks
This commit is contained in:
@@ -68,13 +68,15 @@ describe("cli program", () => {
|
||||
pickProvider.mockResolvedValue("web");
|
||||
monitorWebProvider.mockRejectedValue(new Error("no web"));
|
||||
const program = buildProgram();
|
||||
await program.parseAsync(
|
||||
["relay", "--provider", "auto", "--interval", "2", "--lookback", "1"],
|
||||
{ from: "user" },
|
||||
);
|
||||
await expect(
|
||||
program.parseAsync(
|
||||
["relay", "--provider", "auto", "--interval", "2", "--lookback", "1"],
|
||||
{ from: "user" },
|
||||
),
|
||||
).rejects.toThrow("exit");
|
||||
expect(logWebSelfId).toHaveBeenCalled();
|
||||
expect(ensureTwilioEnv).toHaveBeenCalled();
|
||||
expect(monitorTwilio).toHaveBeenCalledWith(2, 1);
|
||||
expect(ensureTwilioEnv).not.toHaveBeenCalled();
|
||||
expect(monitorTwilio).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("runs relay tmux attach command", async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { sendCommand } from "../commands/send.js";
|
||||
import { statusCommand } from "../commands/status.js";
|
||||
import { webhookCommand } from "../commands/webhook.js";
|
||||
import { ensureTwilioEnv } from "../env.js";
|
||||
import { danger, info, setVerbose, setYes, warn } from "../globals.js";
|
||||
import { danger, info, setVerbose, setYes } from "../globals.js";
|
||||
import {
|
||||
loginWeb,
|
||||
logoutWeb,
|
||||
@@ -215,14 +215,12 @@ Examples:
|
||||
await monitorWebProvider(Boolean(opts.verbose));
|
||||
return;
|
||||
} catch (err) {
|
||||
if (providerPref === "auto") {
|
||||
defaultRuntime.error(
|
||||
warn("Web session unavailable; falling back to twilio."),
|
||||
);
|
||||
} else {
|
||||
defaultRuntime.error(danger(`Web relay failed: ${String(err)}`));
|
||||
defaultRuntime.exit(1);
|
||||
}
|
||||
defaultRuntime.error(
|
||||
danger(
|
||||
`Web relay failed: ${String(err)}. Not falling back; re-link with 'warelay login --provider web'.`,
|
||||
),
|
||||
);
|
||||
defaultRuntime.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user