From d9911a336f6ed52a202e16e6fa48281cd4982283 Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Thu, 1 Oct 2026 10:20:11 +0300 Subject: [PATCH] Use normal USB deadlines for successful protocol fixtures --- apps/device-manager/server/b2-usb.test.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/device-manager/server/b2-usb.test.mjs b/apps/device-manager/server/b2-usb.test.mjs index e54a367..5dda14c 100644 --- a/apps/device-manager/server/b2-usb.test.mjs +++ b/apps/device-manager/server/b2-usb.test.mjs @@ -23,17 +23,19 @@ function fixture({ model = 231, silence = false, change = false, incomplete = fa return { serial: { async requestPort(options) { assert.deepEqual(options.filters, [{ usbVendorId: 0x2e3c, usbProductId: 0x5740 }]); return port; } }, writes, closed: () => closed, stream: () => stream }; } test('read-only USB protocol handles fragmented lines and releases port', async () => { - const f = fixture(); const result = await readB2Usb({ serial: f.serial, timeoutMs: 100 }); + // Successful reads must not depend on CI scheduling within 50–100 ms. + // The dedicated timeout test below supplies its own short deadline. + const f = fixture(); const result = await readB2Usb({ serial: f.serial }); assert.equal(result.settings, 'synthetic-config'); assert.equal(result.before.MN, result.after.MN); assert.deepEqual(f.writes, ['>I 7\r\n', '>D 15;0\r\n', '>I 7\r\n']); assert.ok(f.closed()); }); test('wrong model stops before requesting configuration', async () => { const f = fixture({ model: 999 }); - await assert.rejects(readB2Usb({ serial: f.serial, timeoutMs: 50 }), /не распознано/); + await assert.rejects(readB2Usb({ serial: f.serial }), /не распознано/); assert.deepEqual(f.writes, ['>I 7\r\n']); assert.ok(f.closed()); }); test('identity change cannot produce a registration snapshot', async () => { - const f = fixture({ change: true }); await assert.rejects(readB2Usb({ serial: f.serial, timeoutMs: 50 }), /изменилось устройство/); assert.ok(f.closed()); + const f = fixture({ change: true }); await assert.rejects(readB2Usb({ serial: f.serial }), /изменилось устройство/); assert.ok(f.closed()); }); test('incomplete response and silence time out and close the port', async () => { for (const options of [{ silence: true }, { incomplete: true }]) {