Files
lunch/tests/timer.test.ts
T
kai 0692914666
release / which version (push) Successful in 1s
release / olares chart · sanity (push) Successful in 4s
release / app (push) Successful in 1m0s
release / tag and release (push) Successful in 3s
Cooking mode with timers and wake lock, ratings and thank-yous (26.11.13) (#14)
2026-11-07 05:06:07 +00:00

19 lines
808 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import { timerFromText } from "@/lib/timer";
describe("timer from text", () => {
it("reads minutes, hours and ranges in several languages", () => {
expect(timerFromText("Bei kleiner Hitze 30 Minuten köcheln lassen.")).toBe(1800);
expect(timerFromText("Gemüse dazugeben und 5 Minuten mitbraten.")).toBe(300);
expect(timerFromText("10–15 Min. backen")).toBe(600);
expect(timerFromText("Bake for 1 hour.")).toBe(3600);
expect(timerFromText("Laisser reposer 1,5 heures")).toBe(5400);
});
it("ignores numbers that are not times", () => {
expect(timerFromText("Ofen auf 200 °C vorheizen.")).toBeNull();
expect(timerFromText("2 Eier verquirlen")).toBeNull();
expect(timerFromText("Spaghetti kochen")).toBeNull();
});
});