[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
130
application/AppHandlers.trayJump.test.ts
Normal file
130
application/AppHandlers.trayJump.test.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import type { TerminalSession } from "../domain/models";
|
||||
import {
|
||||
buildAiSilentSessionPopupPayload,
|
||||
handleTrayJumpToSessionImpl,
|
||||
} from "./app/AppHandlers";
|
||||
|
||||
const session = (overrides: Partial<TerminalSession> = {}): TerminalSession => ({
|
||||
id: "session-1",
|
||||
hostId: "host-1",
|
||||
hostLabel: "AI Box",
|
||||
hostname: "10.0.0.1",
|
||||
username: "root",
|
||||
status: "connected",
|
||||
protocol: "ssh",
|
||||
port: 22,
|
||||
...overrides,
|
||||
});
|
||||
|
||||
test("buildAiSilentSessionPopupPayload attaches the same live session PTY", () => {
|
||||
const payload = buildAiSilentSessionPopupPayload(
|
||||
session({ hiddenFromTabs: true }),
|
||||
);
|
||||
|
||||
assert.equal(payload.parentSessionId, "session-1");
|
||||
assert.equal(payload.attachSessionId, "session-1");
|
||||
assert.equal(payload.title, "AI Box");
|
||||
assert.equal(payload.startupCommand, "");
|
||||
assert.equal(payload.sourceSession.hiddenFromTabs, undefined);
|
||||
assert.equal(payload.sourceSession.reuseConnectionFromSessionId, undefined);
|
||||
});
|
||||
|
||||
test("handleTrayJumpToSessionImpl opens a terminal popup for AI silent sessions", async () => {
|
||||
const opened: unknown[] = [];
|
||||
let activeTabId = "session-1";
|
||||
|
||||
await handleTrayJumpToSessionImpl(
|
||||
() => ({
|
||||
sessions: [session({ hiddenFromTabs: true })],
|
||||
setActiveTabId: (id: string) => {
|
||||
activeTabId = id;
|
||||
},
|
||||
getActiveTabId: () => activeTabId,
|
||||
setWorkspaceFocusedSession: () => {
|
||||
throw new Error("should not focus workspace for silent sessions");
|
||||
},
|
||||
netcattyBridge: {
|
||||
get: () => ({
|
||||
openTerminalPopup: async (payload: unknown) => {
|
||||
opened.push(payload);
|
||||
return { success: true, popupId: "popup-1" };
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
"session-1",
|
||||
);
|
||||
|
||||
assert.equal(opened.length, 1);
|
||||
assert.equal(activeTabId, "vault");
|
||||
assert.deepEqual(opened[0], buildAiSilentSessionPopupPayload(session({ hiddenFromTabs: true })));
|
||||
});
|
||||
|
||||
test("handleTrayJumpToSessionImpl still activates normal solo sessions in the main window", async () => {
|
||||
let activeTabId = "vault";
|
||||
let openedMain = 0;
|
||||
|
||||
await handleTrayJumpToSessionImpl(
|
||||
() => ({
|
||||
sessions: [session()],
|
||||
setActiveTabId: (id: string) => {
|
||||
activeTabId = id;
|
||||
},
|
||||
setWorkspaceFocusedSession: () => {
|
||||
throw new Error("solo sessions should not use workspace focus");
|
||||
},
|
||||
netcattyBridge: {
|
||||
get: () => ({
|
||||
openMainWindow: async () => {
|
||||
openedMain += 1;
|
||||
return { success: true };
|
||||
},
|
||||
openTerminalPopup: async () => {
|
||||
throw new Error("should not open popup for visible sessions");
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
"session-1",
|
||||
);
|
||||
|
||||
assert.equal(activeTabId, "session-1");
|
||||
assert.equal(openedMain, 1);
|
||||
});
|
||||
|
||||
test("handleTrayJumpToSessionImpl focuses workspace sessions without opening a popup", async () => {
|
||||
let activeTabId = "vault";
|
||||
let focused: { workspaceId: string; sessionId: string } | null = null;
|
||||
let openedMain = 0;
|
||||
|
||||
await handleTrayJumpToSessionImpl(
|
||||
() => ({
|
||||
sessions: [session({ workspaceId: "ws-1" })],
|
||||
setActiveTabId: (id: string) => {
|
||||
activeTabId = id;
|
||||
},
|
||||
setWorkspaceFocusedSession: (workspaceId: string, sessionId: string) => {
|
||||
focused = { workspaceId, sessionId };
|
||||
},
|
||||
netcattyBridge: {
|
||||
get: () => ({
|
||||
openMainWindow: async () => {
|
||||
openedMain += 1;
|
||||
return { success: true };
|
||||
},
|
||||
openTerminalPopup: async () => {
|
||||
throw new Error("should not open popup for workspace sessions");
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
"session-1",
|
||||
);
|
||||
|
||||
assert.equal(activeTabId, "ws-1");
|
||||
assert.equal(openedMain, 1);
|
||||
assert.deepEqual(focused, { workspaceId: "ws-1", sessionId: "session-1" });
|
||||
});
|
||||
Reference in New Issue
Block a user