From 564dffec35d2ab6772c2561f28d9ad9a2bcbeb40 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 26 Jul 2016 14:04:28 +0200 Subject: Add option to trigger outgoing webhook if first word starts with trigger word (#3611) --- model/outgoing_webhook_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'model/outgoing_webhook_test.go') diff --git a/model/outgoing_webhook_test.go b/model/outgoing_webhook_test.go index 24b81d221..2458c62e4 100644 --- a/model/outgoing_webhook_test.go +++ b/model/outgoing_webhook_test.go @@ -163,3 +163,14 @@ func TestOutgoingWebhookPreUpdate(t *testing.T) { o := OutgoingWebhook{} o.PreUpdate() } + +func TestOutgoingWebhookTriggerWordStartsWith(t *testing.T) { + o := OutgoingWebhook{Id: NewId()} + o.TriggerWords = append(o.TriggerWords, "foo") + if !o.TriggerWordStartsWith("foobar") { + t.Fatal("Should return true") + } + if o.TriggerWordStartsWith("barfoo") { + t.Fatal("Should return false") + } +} -- cgit v1.2.3-1-g7c22