Files
Netcatty/components/top-tabs/SessionTabContextMenuContent.test.ts
T
Netcatty-Bot e8c291373b fix(terminal): add duplicate-session option that opens a fresh connection (#3222)
Add Duplicate Session as an explicit fresh-login alternative to Copy Tab. Keep authenticated transport reuse for Copy Tab and double-clicks, preserve fresh intent across session restoration, and avoid sending a previous target's directory command to a fresh bastion login.

Verified with focused and full tests, lint/build, independent local reviews, and real Electron menu operations against a local SSH server.

Fixes #3221.
2026-08-31 14:28:16 +08:00

29 lines
1.2 KiB
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
import { fileURLToPath } from 'node:url';
import { isSessionReconnectDisabled } from './SessionTabContextMenuContent';
const source = readFileSync(fileURLToPath(new URL('./SessionTabContextMenuContent.tsx', import.meta.url)), 'utf8');
test('reconnect is disabled while a session is still connecting', () => {
assert.equal(isSessionReconnectDisabled('connecting'), true);
assert.equal(isSessionReconnectDisabled('connected'), false);
assert.equal(isSessionReconnectDisabled('disconnected'), false);
assert.equal(isSessionReconnectDisabled('disconnected', true), true);
});
test('session tab menu exposes optional edit-host when a vault host is present', () => {
assert.match(source, /editHost\?: Host/);
assert.match(source, /onEditHost\?: \(host: Host\) => void/);
assert.match(source, /editHost && onEditHost/);
assert.match(source, /terminal\.layer\.hostTree\.editHost/);
});
test('session tab menu offers duplicate-session alongside copy-tab', () => {
assert.match(source, /onDuplicateSession\?: \(sessionId: string\) => void/);
assert.match(source, /onDuplicateSession &&/);
assert.match(source, /tabs\.duplicateSession/);
});