mirror of
https://github.com/mvschwarz/openrig.git
synced 2026-11-07 05:56:21 -10:00
test(cli): separate HTTP error cases from chatroom wait deadline (#1609)
Test only. Four `rig chatroom wait` cases in `chatroom.test.ts` check how an HTTP error from the daemon (404, 500, 503 with an empty or null body) is reported. They used a 0.05-second `--timeout`, which could expire before the stubbed error was reported, so the test sometimes saw the timeout instead. They now use 30 seconds, so each ends on the stubbed error. Fractional deadlines are still tested by their own cases.
This commit is contained in:
1 parent
d6038a381c
commit
cf00cda216
1 file changed
+5
-4
@@ -316,14 +316,15 @@ describe("Chatroom CLI", () => {
|
||||
expect(parsed[0].sender).toBe("alice");
|
||||
});
|
||||
|
||||
// HTTP errors must settle before the command deadline; fractional deadlines are tested below.
|
||||
it.each([
|
||||
["history", [], 404, { error: "Rig removed" }],
|
||||
["history", ["--json"], 500, { error: "History unavailable" }],
|
||||
["wait", ["--timeout", "0.05"], 404, { error: "Rig removed" }],
|
||||
["wait", ["--timeout", "0.05", "--json"], 500, { error: "History unavailable" }],
|
||||
["wait", ["--timeout", "30"], 404, { error: "Rig removed" }],
|
||||
["wait", ["--timeout", "30", "--json"], 500, { error: "History unavailable" }],
|
||||
["history", [], 503, {}],
|
||||
["wait", ["--timeout", "0.05"], 503, {}],
|
||||
["wait", ["--timeout", "0.05"], 503, null],
|
||||
["wait", ["--timeout", "30"], 503, {}],
|
||||
["wait", ["--timeout", "30"], 503, null],
|
||||
] as const)("chatroom %s reports an HTTP error (%s, %s)", async (command, options, status, body) => {
|
||||
historyFailure = { status, body };
|
||||
capturedUrls.length = 0;
|
||||
|
||||
Reference in new issue
Block a user