import { describe, expect, test } from "bun:test"
import { parseVoiceInput } from "./voice-command-parser"

describe("parseVoiceInput", () => {
  test("detects send command", () => {
    expect(parseVoiceInput("please send")).toEqual({ type: "command", command: "send", raw: "please send" })
  })

  test("detects clear command", () => {
    expect(parseVoiceInput("clear prompt")).toEqual({ type: "command", command: "clear", raw: "clear prompt" })
  })

  test("returns text for longer phrases", () => {
    expect(parseVoiceInput("please refactor the login form")).toEqual({
      type: "text",
      text: "please refactor the login form",
    })
  })

  test("disables commands when requested", () => {
    expect(parseVoiceInput("send", false)).toEqual({ type: "text", text: "send" })
  })
})
