From a375dd3db9a2fc6c8bcd69beeb8964c5bfbc2513 Mon Sep 17 00:00:00 2001 From: Admin <1+admin@noreply.git.dcntrlized.org> Date: Mon, 19 Oct 2026 02:34:20 +0100 Subject: [PATCH] [test](client): pin the socket URL to the instance path The socket move from a direct /ws/alarm host:port URL to ws(s)://{instance}/api/alarm/ws/alarm is a wire-contract change; assert the exact URL construction so a future connection refactor cannot silently reintroduce a second origin. --- __tests__/alarmSocket.test.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/__tests__/alarmSocket.test.ts b/__tests__/alarmSocket.test.ts index 65113be..72f1dee 100644 --- a/__tests__/alarmSocket.test.ts +++ b/__tests__/alarmSocket.test.ts @@ -88,7 +88,6 @@ describe('frame contract', () => { action: 'trigger', message: 'Fire drill', serverTime: '2026-10-18T17:00:00Z', - autoStopSeconds: 60, }); expect(parseFrame(raw)).toEqual({ type: 'alarm', @@ -97,10 +96,25 @@ describe('frame contract', () => { action: 'trigger', message: 'Fire drill', serverTime: '2026-10-18T17:00:00Z', - autoStopSeconds: 60, }); }); + it('ignores a legacy autoStopSeconds field instead of carrying it forward', () => { + // The service no longer sends it; a stale sender must not resurrect the + // "alarm expires on a timer" behaviour in any consumer. + const frame = parseFrame( + JSON.stringify({ + type: 'alarm', + alertId: 'a', + eventId: 'e', + action: 'trigger', + autoStopSeconds: 60, + }), + ); + expect(frame.type).toBe('alarm'); + expect(frame).not.toHaveProperty('autoStopSeconds'); + }); + it('parses a disarm frame', () => { const frame = parseFrame( JSON.stringify({ type: 'alarm', alertId: 'a', eventId: 'e', action: 'disarm' }),