Skip to content

Commit 0a7c7e9

Browse files
committed
test(voip): update iOS push-token test for dropped guard
Base branch feat.voip-lib-new removed the iOS early-return when voipToken is missing. Flip the test to assert registerPushToken now posts an apn payload without voipToken.
1 parent b85d1a5 commit 0a7c7e9

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

app/lib/services/restApi.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,25 @@ describe('registerPushToken', () => {
123123
expect(mockSdkPost).not.toHaveBeenCalled();
124124
});
125125

126-
it('on iOS returns early when push token exists but VoIP token is missing', async () => {
126+
it('on iOS registers apn payload without voipToken when VoIP token is missing', async () => {
127127
const { registerPushToken, getDeviceToken: getToken, getLastVoipToken: getVoip } = loadRegisterPushToken('ios');
128128
getToken.mockReturnValue('apns-token');
129129
getVoip.mockReturnValue('');
130130

131131
await registerPushToken();
132132

133-
expect(mockSdkPost).not.toHaveBeenCalled();
133+
expect(mockSdkPost).toHaveBeenCalledTimes(1);
134+
expect(mockSdkPost).toHaveBeenCalledWith(
135+
'push.token',
136+
expect.objectContaining({
137+
id: 'unique-device-id',
138+
value: 'apns-token',
139+
type: 'apn',
140+
appName: expect.any(String)
141+
})
142+
);
143+
const payload = mockSdkPost.mock.calls[0][1] as Record<string, unknown>;
144+
expect(Object.prototype.hasOwnProperty.call(payload, 'voipToken')).toBe(false);
134145
});
135146

136147
it('on Android still registers when VoIP token is missing', async () => {

0 commit comments

Comments
 (0)