Files
Netcatty/domain/hostGroupTree.test.ts
T
陈大猫andCursor 36e5779d94 perf(terminal): reduce terminal tab-switch and layout jank (#1321)
* perf(terminal): smooth layout drags and faster tab switching

Defer xterm refit during split, sidebar, and host-tree drags while keeping pane containers in sync with live layout measurements. Refactor TerminalLayer into focused sections with TabBridge/memo optimizations and add the terminal host tree sidebar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(terminal): keep side panels alive and guard session attach races

Prevent terminal boot unmount from leaking backend sessions, keep SFTP/scripts/theme/AI state when switching side tabs, and defer heavy SFTP UI mount so first entry stays responsive.

Co-authored-by: Cursor <cursoragent@cursor.com>

* perf(terminal): reduce tab switch jank

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 03:35:03 +08:00

34 lines
851 B
TypeScript

import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { buildHostGroupTree } from './hostGroupTree';
import type { Host } from '../types';
const host = (id: string, label: string, group?: string): Host => ({
id,
label,
hostname: `${id}.example.com`,
username: 'root',
port: 22,
group,
tags: [],
});
describe('buildHostGroupTree', () => {
it('groups hosts and keeps ungrouped hosts separate', () => {
const { groupTree, ungroupedHosts } = buildHostGroupTree(
[
host('1', 'web-1', 'prod/web'),
host('2', 'db-1', 'prod/db'),
host('3', 'local'),
],
['prod/web'],
);
assert.equal(groupTree.length, 1);
assert.equal(groupTree[0].name, 'prod');
assert.equal(ungroupedHosts.length, 1);
assert.equal(ungroupedHosts[0].id, '3');
});
});