Files
lunch/tests/timer.test.ts
T
Kai BöhmandClaude Opus 5.5 2c6dbd06be
ci / olares chart · sanity (pull_request) Successful in 3s
ci / app · types + tests + build (pull_request) Successful in 2m57s
markt / eintrag (pull_request) Successful in 20s
ci / oberfläche · Browser am iPhone (pull_request) Successful in 6m38s
Cooking mode with timers and wake lock, ratings and thank-yous (26.11.13)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUc2nv7rJVU2gp3Bgtha3q
2026-11-07 04:58:40 +00:00

19 lines
808 B
TypeScript
Raw 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();
});
});