import { describe, it, expect } from 'vitest';
import { mountEmberAvatar } from '../../../../dashboard/modules/emberAvatarRenderer.js';
function fakeCanvas() {
    return { width: 240, height: 240, getContext: () => null };
}
describe('mountEmberAvatar (lifecycle glue)', () => {
    it('schedules an animation frame on mount', () => {
        const requested = [];
        mountEmberAvatar({
            canvas: fakeCanvas(),
            requestFrame: (callback) => {
                requested.push(callback);
                return requested.length;
            },
            cancelFrame: () => undefined,
            now: () => 0,
        });
        expect(requested).toHaveLength(1);
    });
    it('cancels the scheduled frame on destroy so the loop cannot leak', () => {
        const cancelled = [];
        const controls = mountEmberAvatar({
            canvas: fakeCanvas(),
            requestFrame: () => 42,
            cancelFrame: (handle) => {
                cancelled.push(handle);
            },
            now: () => 0,
        });
        controls.destroy();
        expect(cancelled).toEqual([42]);
    });
    it('exposes setState and destroy controls', () => {
        const controls = mountEmberAvatar({
            canvas: fakeCanvas(),
            requestFrame: () => 1,
            cancelFrame: () => undefined,
            now: () => 0,
        });
        expect(typeof controls.setState).toBe('function');
        expect(typeof controls.destroy).toBe('function');
    });
});
//# sourceMappingURL=emberAvatarRenderer.test.js.map