mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-31 23:55:23 +00:00
feat(tmux-monitor): add a unified multi-host view (#1520)
This commit is contained in:
1 parent
cbbb80bc82
commit
4c2f54dac0
12 files changed
+1192
-115
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { createPollQueue } from "../../src/frontend/poll-queue";
|
||||
|
||||
describe("background host polling queue", () => {
|
||||
it("bounds concurrent hosts and releases a slot after failure", async () => {
|
||||
const run = createPollQueue(2);
|
||||
let release!: () => void;
|
||||
const held = new Promise<void>((resolve) => {
|
||||
release = resolve;
|
||||
});
|
||||
const first = run(() => held);
|
||||
const second = run(async () => {
|
||||
throw new Error("offline");
|
||||
});
|
||||
const thirdTask = vi.fn(async () => "third");
|
||||
const third = run(thirdTask);
|
||||
expect(thirdTask).not.toHaveBeenCalled();
|
||||
await expect(second).rejects.toThrow("offline");
|
||||
await expect(third).resolves.toBe("third");
|
||||
expect(thirdTask).toHaveBeenCalledOnce();
|
||||
release();
|
||||
await first;
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user