29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { failureMessage, formatShortParisDateTime } from '@/admin/labels'
|
|
import { en } from '@/i18n/en'
|
|
import { fr } from '@/i18n/fr'
|
|
|
|
describe('failure messages of the submission', () => {
|
|
it.each(['round.open', 'view.asset.unknown'] as const)(
|
|
'%s has its own wording, never the generic unavailable one',
|
|
(kind) => {
|
|
for (const dict of [fr, en]) {
|
|
const t = (key: string) => dict[key]
|
|
const message = failureMessage(t, kind)
|
|
expect(message).toBe(dict[`admin.failure.${kind}`])
|
|
expect(message).not.toBe(dict['admin.failure.unavailable'])
|
|
}
|
|
},
|
|
)
|
|
})
|
|
|
|
describe('formatShortParisDateTime (A8)', () => {
|
|
it('reads « 9 nov. 2026, 12:06 » in French and « 9 Nov 2026, 12:06 » in English, in Paris time', () => {
|
|
expect(formatShortParisDateTime('2026-11-09T11:06:00.123456+00:00', 'fr')).toBe('9 nov. 2026, 12:06')
|
|
expect(formatShortParisDateTime('2026-11-09T11:06:00.123456+00:00', 'en')).toBe('9 Nov 2026, 12:06')
|
|
})
|
|
it('follows the Paris summer offset', () => {
|
|
expect(formatShortParisDateTime('2026-07-01T22:30:00+00:00', 'fr')).toBe('2 juil. 2026, 00:30')
|
|
})
|
|
})
|