fix(app): grant expiry ends the chosen day in Paris; species order 0..9999 (V1-2.5 L2)
Owner checkpoint 2026-11-02: expiry 23:59:59.999 Europe/Paris (picker, validation, display), tests under non-Paris zones and DST days; M7 redefines create_species and update_inactive_species with the range check; pgTAP 015 and 022; « Relecteur ou relectrice »; object_conflict EN; setup key selectable, no Copy.
This commit is contained in:
1 parent
4111efa1d1
commit
51225cacf6
17 files changed
+437
-61
No files matched your search
@@ -1,5 +1,12 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { formatDate, todayIso, nowIso } from '@/lib/dates'
|
||||
import { afterAll, beforeAll, describe, it, expect } from 'vitest'
|
||||
import {
|
||||
endOfParisDayIso,
|
||||
formatDate,
|
||||
nowIso,
|
||||
parisDateIso,
|
||||
parisTomorrowIso,
|
||||
todayIso,
|
||||
} from '@/lib/dates'
|
||||
|
||||
describe('formatDate fr', () => {
|
||||
it('formats "2026-05-18" as "18 mai 2026"', () => {
|
||||
@@ -38,3 +45,47 @@ describe('nowIso', () => {
|
||||
expect(nowIso()).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/)
|
||||
})
|
||||
})
|
||||
|
||||
// A zone west and a zone east of Paris: the Paris rules never follow the device.
|
||||
describe.each(['America/Los_Angeles', 'Pacific/Kiritimati'])(
|
||||
'Paris days under the device zone %s',
|
||||
(zone) => {
|
||||
const previous = process.env.TZ
|
||||
beforeAll(() => {
|
||||
process.env.TZ = zone
|
||||
expect(Intl.DateTimeFormat().resolvedOptions().timeZone).toBe(zone)
|
||||
})
|
||||
afterAll(() => {
|
||||
if (previous === undefined) delete process.env.TZ
|
||||
else process.env.TZ = previous
|
||||
})
|
||||
|
||||
it.each([
|
||||
['2026-01-15', '2026-01-15T22:59:59.999Z'],
|
||||
['2026-07-15', '2026-07-15T21:59:59.999Z'],
|
||||
['2026-03-28', '2026-03-28T22:59:59.999Z'],
|
||||
['2026-03-29', '2026-03-29T21:59:59.999Z'],
|
||||
['2026-10-25', '2026-10-25T22:59:59.999Z'],
|
||||
])('endOfParisDayIso(%s) is %s', (day, instant) => {
|
||||
expect(endOfParisDayIso(day)).toBe(instant)
|
||||
})
|
||||
|
||||
it('refuses an impossible or malformed day', () => {
|
||||
expect(() => endOfParisDayIso('2026-02-30')).toThrow()
|
||||
expect(() => endOfParisDayIso('2026-1-5')).toThrow()
|
||||
})
|
||||
|
||||
it('parisDateIso reads the Paris date', () => {
|
||||
expect(parisDateIso(new Date('2026-11-02T23:30:00Z'))).toBe('2026-11-03')
|
||||
})
|
||||
|
||||
it('parisTomorrowIso is the next Paris calendar day, DST included', () => {
|
||||
expect(parisTomorrowIso(new Date('2026-03-28T22:30:00Z'))).toBe(
|
||||
'2026-03-29',
|
||||
)
|
||||
expect(parisTomorrowIso(new Date('2026-03-28T23:30:00Z'))).toBe(
|
||||
'2026-03-30',
|
||||
)
|
||||
})
|
||||
},
|
||||
)
|
||||
Reference in new issue
Block a user