import { describe, expect, it } from 'vitest' import { buildDeviceRegistration } from '../src/lib/notifications' describe('device registration', () => { it('builds a _voltro_devices row from an Expo push token (pure with injected env)', () => { const row = buildDeviceRegistration('ExponentPushToken[abc]', 'ios', { locale: 'de-DE', timezone: 'Europe/Berlin', now: () => 1_700_000_000_000, }) expect(row).toMatchObject({ deviceToken: 'ExponentPushToken[abc]', platform: 'ios', locale: 'de-DE', timezone: 'Europe/Berlin', registeredAt: 1_700_000_000_000, metadata: { via: 'expo' }, }) }) it('does NOT carry userId/tenantId — the server stamps those from the request', () => { const row = buildDeviceRegistration('tok', 'android', { now: () => 0 }) expect(row).not.toHaveProperty('userId') expect(row).not.toHaveProperty('tenantId') }) })