mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
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.
29 lines
1.2 KiB
TypeScript
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/);
|
|
});
|