Fail closed on a missing microphone, release partial capture setup, menus show enumeration failures; deterministic packaged smoke launch; NSIS custom-profile update guard

This commit is contained in:
omar committed 2026-10-24 07:07:05 +03:00
1 parent 7afce5ab20
commit 2a71d63b7b
37 files changed
+838 -310

No files matched your search

+31
View File
@@ -79,3 +79,34 @@ test('a failure of a superseded start is ignored; a current failure is reported'
await assert.rejects(current, { name: 'NotAllowedError' });
assert.equal(engine.captureStarting, false);
});
test('a missing explicit device is an error with no second request for another microphone', async () => {
const { engine, pending, flush } = setup();
const start = engine.startCapture({ deviceId: 'gone' });
await flush();
pending[0].reject(Object.assign(new Error('not found'), { name: 'OverconstrainedError' }));
await assert.rejects(start, { code: 'device_unavailable' });
await flush();
assert.equal(pending.length, 1);
assert.equal(engine.capturing, false);
});
test('a failure while building the capture graph releases the opened microphone', async () => {
const { engine, pending, flush } = setup();
const disconnected = [];
engine.ctx.createMediaStreamSource = () => ({ connect: (n) => n, disconnect: () => disconnected.push('source') });
globalThis.AudioWorkletNode = class {
constructor() {
throw new Error('worklet not registered');
}
};
const start = engine.startCapture({});
await flush();
const stream = fakeStream('mic');
pending[0].resolve(stream);
await assert.rejects(start, /worklet not registered/);
assert.equal(stream.track.stopped, true);
assert.deepEqual(disconnected, ['source']);
assert.equal(engine.capturing, false);
assert.equal(engine.captureStarting, false);
});