import {describe, expect, it} from 'vitest'; import {changePasswordSchema, confirmEmailSchema, registrationSchema, settingsSchema} from './validation.js'; const settings = () => ({useDarkTheme: true, language: 'de'}); describe('Steam ID', () => { it('is no form field any more: it comes only from "Sign in through Steam"', () => { expect(settingsSchema.parse({...settings(), steamId: '76561198005679788'})).not.toHaveProperty('steamId'); expect(registrationSchema.parse({ email: 'a@b.de', steamId: '76561198005679788', })).not.toHaveProperty('steamId'); }); }); describe('displayName validation', () => { const withName = (displayName) => ({...settings(), displayName}); it('turns an empty field into null (no display name)', () => { expect(settingsSchema.parse(withName(' ')).displayName).toBeNull(); }); it('trims and keeps a valid name', () => { expect(settingsSchema.parse(withName(' Lobo Corp_1 ')).displayName).toBe('Lobo Corp_1'); }); it.each(['ab', '