From a49f2c3ed7a5129a6b1b177a46df366bbb829888 Mon Sep 17 00:00:00 2001 From: kitty Date: Wed, 10 Nov 2021 20:37:45 +0700 Subject: [PATCH] [GH-174] Add Jira Autolink With Comment (#174) --- server/autolink/lib_jira_test.go | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/server/autolink/lib_jira_test.go b/server/autolink/lib_jira_test.go index 296fc123..55b47006 100644 --- a/server/autolink/lib_jira_test.go +++ b/server/autolink/lib_jira_test.go @@ -118,6 +118,42 @@ var jiraTests = []linkTest{ "Welcome https://mattermost.atlassian.net/browse/MM-12345", "Welcome [MM-12345](https://mattermost.atlassian.net/browse/MM-12345)", }, + { + "Jump To Comment With Jira Cloud", + autolink.Autolink{ + Pattern: "(https://mmtest.atlassian.net/browse/)(DP)(-)(?P\\d+)[?](focusedCommentId)(=)(?P\\d+)", + Template: "[DP-${jira_id} With Focused Comment($comment_id)](https://mmtest.atlassian.net/browse/DP-${jira_id}?focusedCommentId=$comment_id)", + }, + "https://mmtest.atlassian.net/browse/DP-454?focusedCommentId=11347", + "[DP-454 With Focused Comment(11347)](https://mmtest.atlassian.net/browse/DP-454?focusedCommentId=11347)", + }, + { + "Jump To Comment With Jira Ecc", + autolink.Autolink{ + Pattern: "(http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/)(DKHPROJ)(-)(?P\\d+)[?](focusedCommentId)(=)(?P\\d+)", + Template: "[DKHPROJ-${jira_id} With Focused Comment($comment_id)](http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-${jira_id}?focusedCommentId=$comment_id)", + }, + "http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5?focusedCommentId=10200", + "[DKHPROJ-5 With Focused Comment(10200)](http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5?focusedCommentId=10200)", + }, + { + "Jump To Comment With Jira Ecc Long Link", + autolink.Autolink{ + Pattern: "(http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/)(DKHPROJ)(-)(?P\\d+)[?](focusedCommentId)(=)(?P\\d+)", + Template: "[DKHPROJ-${jira_id} With Focused Comment($comment_id)](http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-${jira_id}?focusedCommentId=$comment_id)", + }, + "http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5?focusedCommentId=10200&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-10200", + "http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5?focusedCommentId=10200&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-10200", + }, + { + "Jump To Comment With Jira Ecc Long Short", + autolink.Autolink{ + Pattern: "(http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/)(DKHPROJ)(-)(?P\\d+)[?](focusedCommentId)(=)(?P\\d+)", + Template: "[DKHPROJ-${jira_id} With Focused Comment($comment_id)](http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-${jira_id}?focusedCommentId=$comment_id)", + }, + "http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5", + "http://ec2-54-157-116-101.compute-1.amazonaws.com/browse/DKHPROJ-5", + }, } func TestJira(t *testing.T) {