import { describe, expect, it } from "vitest";

import { breathState } from "./heartTiming";

describe("heart breathing state", () => {
  it("uses one second preparation then five 3/2/4 second breaths", () => {
    expect(breathState(0).word).toBe("静");
    expect(breathState(999).phase).toBe("prepare");
    expect(breathState(1_000).word).toBe("吸");
    expect(breathState(3_999).phase).toBe("inhale");
    expect(breathState(4_000).word).toBe("顿");
    expect(breathState(5_999).phase).toBe("pause");
    expect(breathState(6_000).word).toBe("呼");
    expect(breathState(9_999).phase).toBe("exhale");
    expect(breathState(10_000).word).toBe("吸");
    expect(breathState(45_999).word).toBe("呼");
    expect(breathState(46_000)).toEqual({ word: "定", phase: "complete", progress: 1 });
  });
});
