package router import ( "context" "testing" "time" ) func TestSpellOutDigits(t *testing.T) { for _, tc := range []struct{ in, want string }{ {"напомни мне позвонить маме в семь вечера", "напомни мне позвонить маме в 7 вечера"}, {"в три часа дня", "в 3 часа дня"}, {"напомни в половине шестого", "напомни в 5:30"}, {"через двадцать минут", "через 20 минут"}, // Untouched: no time word stands beside the number. {"купить три яблока", "купить три яблока"}, {"семь раз отмерь", "семь раз отмерь"}, {"напомни в 19:00", "напомни в 19:00"}, {"", ""}, } { if got := SpellOutDigits(tc.in); got != tc.want { t.Errorf("SpellOutDigits(%q) = %q, want %q", tc.in, got, tc.want) } } } // The utterance from the QA sitting that named this bug: the numeric form // parsed and the spoken form did not. func TestStubParsesASpokenHour(t *testing.T) { now := time.Date(2026, 8, 2, 9, 0, 0, 0, time.Local) got, ok, err := StubDateTimeParser{}.Parse(context.Background(), "напомни мне позвонить маме в семь вечера", now) if err != nil || !ok { t.Fatalf("Parse ok=%v err=%v, want a time", ok, err) } if got.Hour() != 19 { t.Fatalf("hour = %d, want 19", got.Hour()) } }