Files
Netcatty/components/sftp/sftpColumnVisibilityIntegration.test.ts
T
bincxz 31d3f76c32 fix(sftp): keep owner when normalizing tree directory listings
Codex review: expanded tree rows rebuild RemoteFile entries without
copying owner, so child panes showed "--" even when the bridge had it.
2026-08-19 15:10:45 +08:00

36 lines
1.5 KiB
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const readSource = (fileName: string): string =>
readFileSync(new URL(fileName, import.meta.url), 'utf8');
test('list and tree SFTP views share column visibility and keyboard-accessible menus', () => {
const listSource = readSource('./SftpPaneFileList.tsx');
const treeSource = readSource('./SftpPaneTreeView.tsx');
const treeNodeSource = readSource('./SftpPaneTreeNode.tsx');
const columnMenuSource = readSource('./SftpColumnMenuItems.tsx');
for (const source of [listSource, treeSource]) {
assert.match(source, /buildSftpColumnTemplate\(columnWidths, visibleColumns\)/);
assert.match(source, /SftpColumnMenuItems/);
assert.match(source, /isSftpColumnMenuKey/);
assert.match(source, /tabIndex=\{0\}/);
}
assert.match(columnMenuSource, /ContextMenuCheckboxItem/);
assert.match(
listSource,
/import\s*\{[^}]*\bContextMenuSeparator\b[^}]*\}\s*from "\.\.\/ui\/context-menu";/,
);
assert.match(treeNodeSource, /visibleColumns\.modified/);
assert.match(treeNodeSource, /visibleColumns\.size/);
assert.match(treeNodeSource, /visibleColumns\.type/);
assert.match(treeNodeSource, /visibleColumns\.owner/);
assert.match(columnMenuSource, /'modified', 'size', 'type', 'owner'/);
const paneCallbacksSource = readFileSync(new URL('./hooks/useSftpViewPaneCallbacks.ts', import.meta.url), 'utf8');
assert.match(paneCallbacksSource, /owner: f\.owner/);
});