| 4 | } from "../../../src/bootstrap/dateChangeDetection"; |
| 5 | |
| 6 | class FakeTimer { |
| 7 | private nextId = 1; |
| 8 | intervals: Array<{ id: number; callback: () => void; timeout: number }> = []; |
| 9 | timeouts: Array<{ id: number; callback: () => void; timeout: number }> = []; |
| 10 | clearedTimeouts: number[] = []; |
| 11 | |
| 12 | setInterval(callback: () => void, timeout: number): number { |
| 13 | const id = this.nextId++; |
| 14 | this.intervals.push({ id, callback, timeout }); |
| 15 | return id; |
| 16 | } |
| 17 | |
| 18 | setTimeout(callback: () => void, timeout: number): number { |
| 19 | const id = this.nextId++; |
| 20 | this.timeouts.push({ id, callback, timeout }); |
| 21 | return id; |
| 22 | } |
| 23 | |
| 24 | clearTimeout(timeoutId: number): void { |
| 25 | this.clearedTimeouts.push(timeoutId); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | describe("date change detection", () => { |
| 30 | it("registers a minute interval and schedules the next local midnight", () => { |
nothing calls this directly
no outgoing calls
no test coverage detected