fix: "save X min ago" only min to min/hours/days

This commit is contained in:
fsylvain committed 2026-09-29 22:56:05 +02:00
1 parent c40522a09f
commit 65ced64568
3 files changed
+26 -8

No files matched your search

@@ -24,9 +24,15 @@ describe('Saved within the hour', () => {
})
describe('Saved over an hour ago', () => {
it('reads "Saved n min ago"', () => {
it.each([
['2026-09-26T12:02:00Z', 'Saved 1 h ago'],
['2026-09-26T12:32:00Z', 'Saved 1 h ago'],
['2026-09-26T23:02:00Z', 'Saved 12 h ago'],
['2026-09-27T11:02:00Z', 'Saved 1 d ago'],
['2026-09-29T15:00:00Z', 'Saved 3 d ago'],
])('at %s reads "%s"', (now, expected) => {
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-09-26T12:32:00Z'))
vi.setSystemTime(new Date(now))
const wrapper = mount(SaveStatus, {
props: {
state: 'saved',
@@ -35,7 +41,7 @@ describe('Saved over an hour ago', () => {
global: { plugins: [uiPlugin] },
})
expect(wrapper.text()).toContain('Saved 90 min ago')
expect(wrapper.text()).toContain(expected)
})
})