Skip to content

Commit 64ea130

Browse files
committed
Fix failing test after vitests update
1 parent 84d656f commit 64ea130

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/app/components/TableCellAge/__tests__/index.test.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ describe('TableCellAge', () => {
1616
vi.setSystemTime(new Date('2024-02-05T10:14:35.000Z'))
1717

1818
// Fix locale-specific mock output
19-
vi.spyOn(Intl, 'DateTimeFormat').mockImplementation(
20-
() =>
21-
({
22-
format: () => '05-02-2024, 10:14:40',
23-
}) as unknown as Intl.DateTimeFormat,
19+
const OriginalDateTimeFormat = Intl.DateTimeFormat
20+
vi.stubGlobal(
21+
'Intl',
22+
Object.assign({}, Intl, {
23+
DateTimeFormat: function (...args: ConstructorParameters<typeof Intl.DateTimeFormat>) {
24+
const instance = new OriginalDateTimeFormat(...args)
25+
return Object.assign({}, instance, {
26+
format: () => '05-02-2024, 10:14:40',
27+
})
28+
},
29+
}),
2430
)
2531
})
2632

0 commit comments

Comments
 (0)