CI / quality (push) Failing after 6m22s
Implements Max_Code_Quality_CICD_Production.md: TypeScript strict mode, ESLint flat config with type-checking and security plugin, Prettier, Husky + lint-staged, Vitest with 80%+ coverage (473 tests), Playwright e2e, Electron security hardening (contextIsolation, CSP, IPC validation), electron-builder + electron-updater, Dockerfile, Gitea Actions CI/release workflows, and SonarQube docker-compose setup. Also fixes two real bugs found while writing tests: unawaited clipboard promises and a mermaid container ref timing issue in CoachDrawingView. Fixes lint-staged on Windows/Node 24 by invoking eslint/prettier via `node <bin>.js` instead of their .cmd shims, which Node's child_process now refuses to spawn without shell:true. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
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/)
|
|
})
|
|
})
|