[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:
@@ -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' }),
|
||||
|
||||
Reference in New Issue
Block a user