Files
client/test/files-renderer.test.mjs
T
omar e6464bc4ed feat: checkpoint account-free client workflows and source-matched UI
Preserve accumulated client implementation since v0.1.4, including local identities, multi-server state, chat, administration, audio and streaming controls. Refine official-source layout, original artwork, responsive composer overflow, settings navigation and chat scroll anchoring.

Current verification: Node suite passes; isolated packaged chat and responsive control smokes pass without device capture. Native core is reused, not rebuilt in this pass. Strict whole-screen visual parity remains incomplete; no 1:1 or cross-platform acceptance claim. Local checkpoint only; no release or push.
2026-11-01 19:43:18 +03:00

42 lines
2.2 KiB
JavaScript

// Offline delayed-picker regressions. No Electron, native dialog, device or server access.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import './fixtures/renderer-env.mjs';
const { S, newConnection } = await import('../app/renderer/js/state.js');
const files = await import('../app/renderer/js/files.js');
function connection() {
S.connections.clear();
const conn = newConnection('c1');
conn.conn = { state: 'connected', address: 'same-fixture.invalid', reason: null };
conn.snap = { server: { features: {} }, channels: [{ id: 1, name: 'Same channel' }] };
S.connections.set('c1', conn);
return conn;
}
test('chat download does not cross reconnect while folder picker is open', async () => {
const conn = connection(); let finish; const starts = []; const released = [];
globalThis.teamspeach.filesChooseDownloadDir = id => { assert.equal(id, 'c1'); return new Promise(resolve => { finish = resolve; }); };
globalThis.teamspeach.filesDownload = async (...args) => { starts.push(args); return { ok: true, result: { transfer_id: 1 } }; };
globalThis.teamspeach.filesRelease = token => released.push(token);
const pending = files.requestServerFileDownload('c1', { channelId: 1, path: '/', name: '日本.bin' });
conn.session += 1;
finish({ ok: true, token: 'fixture-dir' });
assert.equal((await pending).error.code, 'not_connected');
assert.deepEqual(starts, []);
assert.deepEqual(released, ['fixture-dir']);
});
test('chat attachment upload does not cross reconnect while picker is open', async () => {
const conn = connection(); let finish; const starts = []; const released = [];
globalThis.teamspeach.filesChooseUpload = id => { assert.equal(id, 'c1'); return new Promise(resolve => { finish = resolve; }); };
globalThis.teamspeach.filesUpload = async (...args) => { starts.push(args); return { ok: true, result: { transfer_id: 1 } }; };
globalThis.teamspeach.filesRelease = token => released.push(token);
const pending = files.chooseAndUploadChatAttachments('c1', 1);
conn.session += 1;
finish({ ok: true, files: [{ token: 'fixture-file', name: 'Отчёт.bin', size: 5 }] });
assert.deepEqual(await pending, []);
assert.deepEqual(starts, []);
assert.deepEqual(released, ['fixture-file']);
});