import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { animateCounter } from '../../../../dashboard/modules/statsCharts.js';
const globalRecord = globalThis;
let originalRaf;
let originalPerformance;
let fakeTime = 0;
beforeEach(() => {
    originalRaf = globalRecord.requestAnimationFrame;
    originalPerformance = globalRecord.performance;
    fakeTime = 0;
    globalRecord.requestAnimationFrame = (callback) => {
        fakeTime += 1000;
        callback(fakeTime);
        return 0;
    };
    globalRecord.performance = { now: () => fakeTime };
});
afterEach(() => {
    globalRecord.requestAnimationFrame = originalRaf;
    globalRecord.performance = originalPerformance;
});
describe('animateCounter', () => {
    it('eventually sets the textContent to the target value with the suffix', () => {
        const element = { textContent: '' };
        animateCounter(element, 100, 50, ' pts');
        expect(element.textContent).toBe('100 pts');
    });
    it('handles a zero target value', () => {
        const element = { textContent: 'placeholder' };
        animateCounter(element, 0, 50, '');
        expect(element.textContent).toBe('0');
    });
});
//# sourceMappingURL=statsCharts.test.js.map