From 542fab895719551cd228fd6f2e02ff97691e588e Mon Sep 17 00:00:00 2001 From: gubbins Date: Tue, 21 Jan 2020 00:06:39 +1100 Subject: [PATCH] Add test case for JIRA ticket to full URL (#78) --- server/plugin_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/plugin_test.go b/server/plugin_test.go index b1de77e5..a82decc1 100644 --- a/server/plugin_test.go +++ b/server/plugin_test.go @@ -58,7 +58,10 @@ func TestSpecialCases(t *testing.T) { Pattern: "(Example)", Template: "[Example](https://example.com)", }, Link{ - Pattern: "(https://mattermost.atlassian.net/browse/)(MM)(-)(?P\\d+)", + Pattern: "MM-(?P\\d+)", + Template: "[MM-$jira_id](https://mattermost.atlassian.net/browse/MM-$jira_id)", + }, Link{ + Pattern: "https://mattermost.atlassian.net/browse/MM-(?P\\d+)", Template: "[MM-$jira_id](https://mattermost.atlassian.net/browse/MM-$jira_id)", }, Link{ Pattern: "(foo!bar)", @@ -209,6 +212,9 @@ func TestSpecialCases(t *testing.T) { }, { "text https://mattermost.atlassian.net/browse/MM-12345 other text", "text [MM-12345](https://mattermost.atlassian.net/browse/MM-12345) other text", + }, { + "check out MM-12345 too", + "check out [MM-12345](https://mattermost.atlassian.net/browse/MM-12345) too", }, }