feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)
This commit is contained in:
parent
f49acf0105
commit
10af20a0ad
157 changed files with 29455 additions and 913 deletions
|
|
@ -26,8 +26,13 @@ import {
|
|||
import {
|
||||
detachPushRegistrationForLogout,
|
||||
registerPushRegistration,
|
||||
resolveDevicePushProvider,
|
||||
synchronizePushRegistration,
|
||||
} from '../src/features/notifications/notification-service'
|
||||
import {
|
||||
subscribeWebPush,
|
||||
urlBase64ToUint8Array,
|
||||
} from '../../web/src/lib/web-push'
|
||||
|
||||
const USER_ID = '11111111-1111-4111-8111-111111111111'
|
||||
const DEVICE_ID = '22222222-2222-4222-8222-222222222222'
|
||||
|
|
@ -270,4 +275,56 @@ describe('device-bound push registration', () => {
|
|||
expect(mockedSupabase.rpc).not.toHaveBeenCalled()
|
||||
expect(mockedNative.deleteNativePushRegistration).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('registers iOS devices with provider apns while Android uses fcm', async () => {
|
||||
const iosDevice: RegisteredDevice = {
|
||||
...device,
|
||||
platform: 'ios',
|
||||
deviceName: 'iPhone 16 Pro',
|
||||
osVersion: 'iOS 18.1',
|
||||
}
|
||||
const apnsToken = `apns_${'b'.repeat(64)}`
|
||||
expect(resolveDevicePushProvider(device)).toBe('fcm')
|
||||
expect(resolveDevicePushProvider(iosDevice)).toBe('apns')
|
||||
|
||||
mockedNative.getNativeNotificationStatus.mockResolvedValue({
|
||||
configured: true,
|
||||
provider: 'apns',
|
||||
reason: 'configured',
|
||||
permission: 'granted',
|
||||
registrationId: apnsToken,
|
||||
fullSyncRequired: false,
|
||||
})
|
||||
mockedSupabase.rpc.mockResolvedValue({
|
||||
data: {
|
||||
device_id: DEVICE_ID,
|
||||
provider: 'apns',
|
||||
registered_at: '2026-08-21T00:05:00.000Z',
|
||||
},
|
||||
error: null,
|
||||
})
|
||||
|
||||
await expect(synchronizePushRegistration(USER_ID, iosDevice)).resolves.toMatchObject({
|
||||
status: 'registered',
|
||||
registeredAt: '2026-08-21T00:05:00.000Z',
|
||||
})
|
||||
expect(mockedSupabase.rpc).toHaveBeenCalledWith('register_push_registration', {
|
||||
push_device_id: DEVICE_ID,
|
||||
push_provider: 'apns',
|
||||
registration_id: apnsToken,
|
||||
})
|
||||
})
|
||||
|
||||
test('converts VAPID public key and fails closed when VAPID key is absent in web push', async () => {
|
||||
const bytes = urlBase64ToUint8Array('SGVsbG8td29ybGQ')
|
||||
expect(bytes).toBeInstanceOf(Uint8Array)
|
||||
expect(bytes.length).toBeGreaterThan(0)
|
||||
|
||||
await expect(
|
||||
subscribeWebPush({
|
||||
userId: USER_ID,
|
||||
vapidPublicKey: '',
|
||||
}),
|
||||
).rejects.toMatchObject({ code: 'vapid-key-missing' })
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue