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
105 lines
3.2 KiB
TypeScript
105 lines
3.2 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import { buildNumberShortcutTabTargets, buildTabShortcutNumberById } from './tabShortcutTargets.ts';
|
|
|
|
test('number shortcut tabs include vault and sftp by default', () => {
|
|
assert.deepEqual(
|
|
buildNumberShortcutTabTargets({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: false,
|
|
orderedTabs: ['session-1', 'workspace-1'],
|
|
editorTabIds: ['editor:file-1'],
|
|
}),
|
|
['vault', 'sftp', 'session-1', 'workspace-1', 'editor:file-1'],
|
|
);
|
|
});
|
|
|
|
test('number shortcut tabs skip vault and sftp when shell-only mode is enabled', () => {
|
|
assert.deepEqual(
|
|
buildNumberShortcutTabTargets({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: true,
|
|
orderedTabs: ['session-1', 'workspace-1'],
|
|
editorTabIds: ['editor:file-1'],
|
|
}),
|
|
['session-1', 'workspace-1', 'editor:file-1'],
|
|
);
|
|
});
|
|
|
|
test('hidden sftp tab is omitted from default number shortcut targets', () => {
|
|
assert.deepEqual(
|
|
buildNumberShortcutTabTargets({
|
|
showSftpTab: false,
|
|
shellOnlyTabNumberShortcuts: false,
|
|
orderedTabs: ['session-1'],
|
|
editorTabIds: [],
|
|
}),
|
|
['vault', 'session-1'],
|
|
);
|
|
});
|
|
|
|
test('editor tabs already present in native ordering are not appended twice', () => {
|
|
assert.deepEqual(
|
|
buildNumberShortcutTabTargets({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: false,
|
|
orderedTabs: ['session-1', 'editor:file-1', 'plugin-view:one'],
|
|
editorTabIds: ['editor:file-1'],
|
|
}),
|
|
['vault', 'sftp', 'session-1', 'editor:file-1', 'plugin-view:one'],
|
|
);
|
|
});
|
|
|
|
test('pinned tabs cannot be duplicated by a malformed persisted work ordering', () => {
|
|
assert.deepEqual(
|
|
buildNumberShortcutTabTargets({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: false,
|
|
orderedTabs: ['vault', 'session-1', 'sftp'],
|
|
editorTabIds: [],
|
|
}),
|
|
['vault', 'sftp', 'session-1'],
|
|
);
|
|
});
|
|
|
|
test('shortcut number map uses 1-based indices matching Ctrl/Cmd+[1...9]', () => {
|
|
const map = buildTabShortcutNumberById({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: false,
|
|
orderedTabs: ['session-1', 'workspace-1'],
|
|
editorTabIds: [],
|
|
});
|
|
assert.equal(map.get('vault'), 1);
|
|
assert.equal(map.get('sftp'), 2);
|
|
assert.equal(map.get('session-1'), 3);
|
|
assert.equal(map.get('workspace-1'), 4);
|
|
});
|
|
|
|
test('shortcut number map skips pinned tabs in shell-only mode', () => {
|
|
const map = buildTabShortcutNumberById({
|
|
showSftpTab: true,
|
|
shellOnlyTabNumberShortcuts: true,
|
|
orderedTabs: ['session-1', 'workspace-1'],
|
|
editorTabIds: [],
|
|
});
|
|
assert.equal(map.has('vault'), false);
|
|
assert.equal(map.has('sftp'), false);
|
|
assert.equal(map.get('session-1'), 1);
|
|
assert.equal(map.get('workspace-1'), 2);
|
|
});
|
|
|
|
test('shortcut number map caps at nine entries', () => {
|
|
const orderedTabs = Array.from({ length: 12 }, (_, index) => `session-${index + 1}`);
|
|
const map = buildTabShortcutNumberById({
|
|
showSftpTab: false,
|
|
shellOnlyTabNumberShortcuts: true,
|
|
orderedTabs,
|
|
editorTabIds: [],
|
|
});
|
|
assert.equal(map.size, 9);
|
|
assert.equal(map.get('session-1'), 1);
|
|
assert.equal(map.get('session-9'), 9);
|
|
assert.equal(map.has('session-10'), false);
|
|
});
|