package main import ( "context" "testing" "github.com/kami/maven/internal/router" ) // TestCalendarStepsAsideForTheWorld — the defect (Vikunja #552). Weather was // one instance of a wider class, and V-474 fixed only that instance. Every one // of these answered "на 05.08.2026 ничего нет" on the deployed daemon, and // every one of them has an answer in search, which sits below the calendar. func TestCalendarStepsAsideForTheWorld(t *testing.T) { h, api := contQueryHandler() for _, u := range []string{ "во сколько закат сегодня", "какой сегодня курс доллара", "какой сегодня праздник", "что интересного произошло сегодня в мире", } { if reply, ok := h.queryCalendar(context.Background(), &queryTurn{ dec: router.Decision{Intent: router.IntentQuery, Utterance: u}, }); ok { t.Errorf("the calendar claimed %q with %q", u, reply) } } if api.events != 0 { t.Errorf("CalendarEvents called %d times for world questions, want 0", api.events) } } // The other half of the same narrowing: a question about his own day still // reaches the calendar, including the one that names no subject at all. func TestCalendarStillAnswersHisDay(t *testing.T) { for _, u := range []string{ "что у меня сегодня", "во сколько у меня встреча сегодня", "какие встречи завтра", "что в календаре на завтра", "что сегодня?", } { h, _ := contQueryHandler() if _, ok := h.queryCalendar(context.Background(), &queryTurn{ dec: router.Decision{Intent: router.IntentQuery, Utterance: u}, }); !ok { t.Errorf("the calendar passed on %q", u) } } } // A continuation carries its subject in the turn before it, and the calendar // is the only date-aware source, so the narrowing must not reach it. func TestCalendarStillAnswersAContinuation(t *testing.T) { h, _ := contQueryHandler() if _, ok := h.queryCalendar(context.Background(), &queryTurn{ dec: router.Decision{Intent: router.IntentQuery, Utterance: "а завтра?", Continued: true}, }); !ok { t.Error("the calendar passed on a continuation") } }