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.
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import vm from 'node:vm';
|
|
|
|
test('capture processor emits complete frames and terminates explicitly without further audio', () => {
|
|
let Processor;
|
|
const messages = [];
|
|
const context = vm.createContext({
|
|
sampleRate: 48000,
|
|
currentFrame: 48000,
|
|
AudioWorkletProcessor: class {
|
|
constructor() { this.port = { postMessage: data => messages.push(data), close() { this.closed = true; } }; }
|
|
},
|
|
registerProcessor: (_name, type) => { Processor = type; },
|
|
});
|
|
vm.runInContext(readFileSync(new URL('../app/renderer/js/audio/capture-worklet.js', import.meta.url), 'utf8'), context);
|
|
const processor = new Processor();
|
|
const input = [[new Float32Array(960).fill(0.25)]];
|
|
const output = [[new Float32Array(960)]];
|
|
assert.equal(processor.process(input, output), true);
|
|
assert.equal(messages.length, 1);
|
|
assert.equal(messages[0].pcm.byteLength, 1920);
|
|
assert.equal(messages[0].rms, 0.25);
|
|
assert.equal(messages[0].capturedAt, 1.02);
|
|
processor.port.onmessage({ data: { type: 'stop' } });
|
|
assert.equal(processor.process(input, output), false);
|
|
assert.equal(processor.port.closed, true);
|
|
assert.equal(messages.length, 2);
|
|
assert.equal(messages[1].type, 'stopped');
|
|
});
|