feat(hosts): manage servers and encrypted SSH credentials in UI (#7)
This commit is contained in:
@@ -44,3 +44,16 @@ it("starts before notebooks exists and cancels pending notifications on close",
|
||||
await new Promise((r) => setTimeout(r, 600)); expect(listener).not.toHaveBeenCalled();
|
||||
} finally { await watcher.close(); await rm(dir, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
it("publishes hosts.yaml changes, atomic replacements and deletion", async () => {
|
||||
const dir = await mkdtemp(join(tmpdir(), "shellbook-hostwatch-"));
|
||||
const file = join(dir, "hosts.yaml"); await writeFile(file, "[]");
|
||||
const watcher = createNotebookWatcher(dir, { debounceMs: 10 });
|
||||
const events: NotebookFileEvent[] = []; watcher.on(e => events.push(e));
|
||||
try {
|
||||
await watcher.ready; await writeFile(file + ".tmp", "# changed\n[]"); await rename(file + ".tmp", file);
|
||||
await vi.waitFor(() => expect(events).toContainEqual({ type: "file.changed", path: "hosts.yaml" }));
|
||||
await rm(file);
|
||||
await vi.waitFor(() => expect(events).toContainEqual({ type: "file.deleted", path: "hosts.yaml" }));
|
||||
} finally { await watcher.close(); await rm(dir, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user