You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
557 B
TypeScript
20 lines
557 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { validatePlayerName } from './validation'
|
|
|
|
describe('validatePlayerName', () => {
|
|
it('accepts a valid player name', () => {
|
|
expect(validatePlayerName('Player 42')).toBeNull()
|
|
})
|
|
|
|
it('rejects too short names', () => {
|
|
expect(validatePlayerName('A')).toBe('Le nom doit faire au moins 2 caractères')
|
|
})
|
|
|
|
it('rejects non alphanumeric characters', () => {
|
|
expect(validatePlayerName('Player@42')).toBe(
|
|
'Le nom doit contenir seulement lettres, chiffres et espaces'
|
|
)
|
|
})
|
|
})
|