2026-01-02 13:41:09 +00:00
|
|
|
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
2023-09-14 12:15:49 +00:00
|
|
|
|
2026-04-10 08:45:36 +00:00
|
|
|
import { install, type Clock } from '@sinonjs/fake-timers'
|
2023-09-14 12:15:49 +00:00
|
|
|
|
|
|
|
|
const useFakeTimers = (config: { now: Date }) => {
|
2026-04-10 08:45:36 +00:00
|
|
|
const clock = install(config) as Clock & { restore(): void }
|
2023-09-14 12:15:49 +00:00
|
|
|
clock.restore = clock.uninstall
|
|
|
|
|
return clock
|
|
|
|
|
}
|
|
|
|
|
// support old-style sinon.useFakeTimers instead of overriding a method for mobile tests
|
|
|
|
|
Reflect.set(globalThis, 'sinon', { useFakeTimers })
|