import { describe, it, expect, vi } from 'vitest' const pressVirtualKey = vi.fn(async () => {}) vi.mock('../../src/main/skills/windows/lib/sendVirtualKey', () => ({ pressVirtualKey })) const { systemVolume } = await import('../../src/main/skills/windows/systemVolume') describe('control_volume', () => { it('should mute with a single key press regardless of steps', async () => { pressVirtualKey.mockClear() const result = await systemVolume.execute({ action: 'couper', steps: 10 }) expect(result).toMatch(/coupe/) expect(pressVirtualKey).toHaveBeenCalledWith(0xad, 1) }) it('should increase volume using the default 5 steps when none is given', async () => { pressVirtualKey.mockClear() await systemVolume.execute({ action: 'augmenter' }) expect(pressVirtualKey).toHaveBeenCalledWith(0xaf, 5) }) it('should decrease volume using the given number of steps, capped at 25', async () => { pressVirtualKey.mockClear() await systemVolume.execute({ action: 'baisser', steps: 999 }) expect(pressVirtualKey).toHaveBeenCalledWith(0xae, 25) }) it('should throw on an invalid action', async () => { await expect(systemVolume.execute({ action: 'danser' })).rejects.toThrow(/action invalide/) }) })