Rename and remove now live on each sidebar row instead of a header above the workspace. The pen swaps the row to an inline input (Enter or blur saves, Escape cancels and returns focus to the pen) and the remove control targets its own row without switching the open connection. The row shows a status dot with text; on mobile a bar beside Show connections shows the open connection and its status. The per-connection activity timeline and its saved transfer history are removed. Records from pre-release 0.0.5 builds lose their history field on first load. A removal dialog closes when another tab removes its connection, and focus moves to the next row after removing another one. The README is reorganized without repetition and corrects the TypeScript version; the 0.0.5 changelog now describes the net change since 0.0.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { emptyConnection, updateConnection } from '../src/lib/connections.ts';
|
|
|
|
test('renaming and pairing preserve a slot identity', () => {
|
|
const initial = emptyConnection(2);
|
|
const renamed = updateConnection(initial, { name: ' Work laptop ' });
|
|
const remembering = updateConnection(renamed, { rememberDevice: true });
|
|
const paired = updateConnection(remembering, { peerKey: '04' + 'a'.repeat(128) });
|
|
assert.equal(initial.name, 'Con 2');
|
|
assert.equal(initial.rememberDevice, false);
|
|
assert.equal(paired.rememberDevice, true);
|
|
assert.equal(updateConnection(paired, { peerKey: '' }).rememberDevice, true, 'Forgetting a device keeps the opt-in');
|
|
assert.equal(paired.id, initial.id);
|
|
assert.equal(paired.name, 'Work laptop');
|
|
assert.equal('history' in paired, false);
|
|
assert.throws(() => updateConnection(paired, { name: ' ' }));
|
|
assert.throws(() => updateConnection(paired, { name: 'a'.repeat(81) }));
|
|
assert.throws(() => updateConnection(paired, { peerKey: 'invalid' }));
|
|
});
|