fix: deleted image wrongfully caching

This commit is contained in:
fsylvain committed 2026-10-01 05:27:25 +02:00
1 parent b3793d5dbb
commit ff0854f331
19 files changed
+201 -87

No files matched your search

+9 -27
View File
@@ -5,56 +5,38 @@ const now = new Date('2026-08-25T12:00:00Z')
describe('formatRelativeDate', () => {
it('formats under an hour in minutes', () => {
expect(formatRelativeDate('2026-08-25T11:45:00Z', now)).toBe(
'15 minutes ago',
)
expect(formatRelativeDate('2026-08-25T11:45:00Z', now)).toBe('15 minutes ago')
})
it('clamps a sub-minute difference to "1 minute ago"', () => {
expect(formatRelativeDate('2026-08-25T11:59:45Z', now)).toBe(
'1 minute ago',
)
expect(formatRelativeDate('2026-08-25T11:59:45Z', now)).toBe('1 minute ago')
})
it('uses the singular for exactly one minute ago', () => {
expect(formatRelativeDate('2026-08-25T11:59:00Z', now)).toBe(
'1 minute ago',
)
expect(formatRelativeDate('2026-08-25T11:59:00Z', now)).toBe('1 minute ago')
})
it('formats under a day in hours', () => {
expect(formatRelativeDate('2026-08-25T10:00:00Z', now)).toBe(
'2 hours ago',
)
expect(formatRelativeDate('2026-08-25T10:00:00Z', now)).toBe('2 hours ago')
})
it('uses the singular for exactly one hour ago', () => {
expect(formatRelativeDate('2026-08-25T11:00:00Z', now)).toBe(
'1 hour ago',
)
expect(formatRelativeDate('2026-08-25T11:00:00Z', now)).toBe('1 hour ago')
})
it('formats exactly one day back as Yesterday', () => {
expect(formatRelativeDate('2026-08-24T11:00:00Z', now)).toBe(
'Yesterday',
)
expect(formatRelativeDate('2026-08-24T11:00:00Z', now)).toBe('Yesterday')
})
it('formats within the week in days', () => {
expect(formatRelativeDate('2026-08-22T12:00:00Z', now)).toBe(
'3 days ago',
)
expect(formatRelativeDate('2026-08-22T12:00:00Z', now)).toBe('3 days ago')
})
it('formats exactly 7 days ago as an absolute date, not "7 days ago"', () => {
expect(formatRelativeDate('2026-08-18T12:00:00Z', now)).toBe(
'18 Aug 2026',
)
expect(formatRelativeDate('2026-08-18T12:00:00Z', now)).toBe('18 Aug 2026')
})
it('formats a week or more ago as an absolute date', () => {
expect(formatRelativeDate('2026-08-10T12:00:00Z', now)).toBe(
'10 Aug 2026',
)
expect(formatRelativeDate('2026-08-10T12:00:00Z', now)).toBe('10 Aug 2026')
})
})