b15fd30c4f
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 8s
CI / integration (pull_request) Successful in 12s
CI / ui (pull_request) Successful in 27s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m6s
- #4 bag label: '{n} in the bag' / 'Bag is empty' (was 'Bag {n}') - #6 allow a single trailing dot in display names (backend + UI regex + tests) - #1 double-tap zooms toward the tapped cell, not the top-left - #8 shuffle fires a short multi-pulse haptic - #11 highlighted/flashing tiles darken their bottom edge too (shadow joins the flash) - #13 toast slides up from the bottom and fades out - #7 hide the logout button (kept wired behind `hidden`) - #16 admin game seats: left-align numeric columns, clarify the 'Hints used' header
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { awayDurationOk, browserOffset, isOffsetZone, validDisplayName, validEmail } from './profileValidation';
|
|
|
|
describe('validDisplayName', () => {
|
|
it.each([
|
|
['Kaya', true],
|
|
['Кая', true],
|
|
['Name_P. Last', true],
|
|
['Mr.Smith', true],
|
|
['Mr. Smith', true],
|
|
[' Kaya ', true],
|
|
['Name P._Last', false],
|
|
['Name Last', false],
|
|
['_Name', false],
|
|
['Anna B.', true],
|
|
['Name.', true],
|
|
['Name..', false],
|
|
['Name_', false],
|
|
['Name2', false],
|
|
['', false],
|
|
['a'.repeat(33), false],
|
|
])('%s -> %s', (name, ok) => {
|
|
expect(validDisplayName(name)).toBe(ok);
|
|
});
|
|
});
|
|
|
|
describe('validEmail', () => {
|
|
it('accepts a normal address', () => expect(validEmail('you@example.com')).toBe(true));
|
|
it('rejects a missing domain', () => expect(validEmail('you@')).toBe(false));
|
|
it('rejects spaces', () => expect(validEmail('a b@x.com')).toBe(false));
|
|
});
|
|
|
|
describe('awayDurationOk', () => {
|
|
it.each([
|
|
['22:00', '06:00', true],
|
|
['00:00', '12:00', true],
|
|
['08:00', '21:00', false],
|
|
['07:00', '07:00', true],
|
|
['20:00', '09:00', false],
|
|
])('%s-%s -> %s', (s, e, ok) => expect(awayDurationOk(s, e)).toBe(ok));
|
|
});
|
|
|
|
describe('timezone helpers', () => {
|
|
it('detects offset zones', () => {
|
|
expect(isOffsetZone('+03:00')).toBe(true);
|
|
expect(isOffsetZone('Europe/Moscow')).toBe(false);
|
|
});
|
|
it('formats the browser offset as ±HH:MM', () => {
|
|
expect(browserOffset()).toMatch(/^[+-]\d{2}:\d{2}$/);
|
|
});
|
|
});
|