package router import "testing" // TestBareCaptureIsAFactWithNoKey — Vikunja #557. The whole point is the gap: // she must route it as a fact she cannot write yet, so the clarify path asks. func TestBareCaptureIsAFactWithNoKey(t *testing.T) { for _, u := range []string{"запиши", "Запиши.", "запомни, пожалуйста", "отметь!", "note", "запиши-ка"} { m := bareCapturePattern.FindStringSubmatch(u) if m == nil { t.Errorf("%q did not match the shape", u) continue } dec, ok := bareCaptureBuild(m) if !ok { t.Errorf("%q should route as a fact with no key", u) continue } if dec.Intent != IntentFact || dec.Slots.HasKey || dec.Slots.Text != "" { t.Errorf("%q built %+v, want an empty fact", u, dec) } } } // TestBareCaptureDeclinesAnythingWithAnObject — the object cases belong to the // capture markers and the cascade, and a lone non-capture word is not this rule. func TestBareCaptureDeclinesAnythingWithAnObject(t *testing.T) { for _, u := range []string{"запиши что я пил воду", "добавь задачу купить хлеб", "привет", "вода", "расскажи"} { m := bareCapturePattern.FindStringSubmatch(u) if m == nil { continue // shape already declined it } if _, ok := bareCaptureBuild(m); ok { t.Errorf("%q must not be claimed as a bare capture", u) } } }