opencode-voice-dictation/tests/audio.test.ts
opencode-agent 3bd443dde3 feat: initial implementation of OpenCode Voice Dictation
- TypeScript + Vite (vite-plugin-monkey) userscript
- Groq API integration with whisper-large-v3
- Tap-to-toggle recording with noise suppression
- Contenteditable text insertion for OpenCode web
- Ctrl+Space keyboard shortcut (desktop)
- Custom Whisper prompt for software development context
- Recording timer, toast notifications, auto-submit option
- 44 unit tests, 100% line coverage
- Biome linter, Knip, Vitest, CI/CD pipeline
- Bilingual README (EN/RU) with compatibility table
2026-07-08 05:37:17 +00:00

30 lines
885 B
TypeScript

import { describe, expect, it } from "vitest";
import { formatTime } from "../src/audio.js";
describe("formatTime", () => {
it("should format 0 seconds as 00:00", () => {
expect(formatTime(0)).toBe("00:00");
});
it("should format seconds under a minute", () => {
expect(formatTime(5)).toBe("00:05");
expect(formatTime(30)).toBe("00:30");
expect(formatTime(59)).toBe("00:59");
});
it("should format exactly one minute", () => {
expect(formatTime(60)).toBe("01:00");
});
it("should format minutes and seconds", () => {
expect(formatTime(65)).toBe("01:05");
expect(formatTime(125)).toBe("02:05");
expect(formatTime(599)).toBe("09:59");
expect(formatTime(600)).toBe("10:00");
});
it("should pad single digits with leading zero", () => {
expect(formatTime(1)).toBe("00:01");
expect(formatTime(61)).toBe("01:01");
});
});