import {
  describe,
  expect,
  it
} from 'vitest';

import { buildPushDeviceTokenRegistrationPayload, normalizePushPlatform } from './mobile-push-token.rules';

describe('mobile-push-token.rules', () => {
  it('normalizes capacitor runtime platforms', () => {
    expect(normalizePushPlatform('ios')).toBe('ios');
    expect(normalizePushPlatform('android')).toBe('android');
    expect(normalizePushPlatform('web')).toBeNull();
  });

  it('builds a registration payload for the signaling server', () => {
    expect(buildPushDeviceTokenRegistrationPayload({
      userId: 'user-1',
      token: 'abc123',
      platform: 'android'
    })).toEqual({
      userId: 'user-1',
      token: 'abc123',
      platform: 'android'
    });
  });
});
