[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.
This commit is contained in:
2026-10-19 02:34:20 +01:00
parent 7c4788afba
commit a375dd3db9
+16 -2
View File
@@ -88,7 +88,6 @@ describe('frame contract', () => {
action: 'trigger', action: 'trigger',
message: 'Fire drill', message: 'Fire drill',
serverTime: '2026-10-18T17:00:00Z', serverTime: '2026-10-18T17:00:00Z',
autoStopSeconds: 60,
}); });
expect(parseFrame(raw)).toEqual({ expect(parseFrame(raw)).toEqual({
type: 'alarm', type: 'alarm',
@@ -97,10 +96,25 @@ describe('frame contract', () => {
action: 'trigger', action: 'trigger',
message: 'Fire drill', message: 'Fire drill',
serverTime: '2026-10-18T17:00:00Z', 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', () => { it('parses a disarm frame', () => {
const frame = parseFrame( const frame = parseFrame(
JSON.stringify({ type: 'alarm', alertId: 'a', eventId: 'e', action: 'disarm' }), JSON.stringify({ type: 'alarm', alertId: 'a', eventId: 'e', action: 'disarm' }),