Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-174] Add Jira Autolink Issue With Comment Test Case #189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions server/autolink/lib_jira_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ var jiraTests = []linkTest{
}, {
"Not relinking",
autolink.Autolink{
Pattern: "(?P<project_id>\\w+)(-)(?P<jira_id>\\d+)",
Template: "[${project_id}-${jira_id}](https://mattermost.atlassian.net/browse/${project_id}-${jira_id})",
Pattern: "(MM)(-)(?P<jira_id>\\d+)",
Template: "[MM-${jira_id}](https://mattermost.atlassian.net/browse/MM-${jira_id})",
},
"Welcome [MM-12345](https://mattermost.atlassian.net/browse/MM-12345) should not re-link!",
"Welcome [MM-12345](https://mattermost.atlassian.net/browse/MM-12345) should not re-link!",
Expand Down Expand Up @@ -121,18 +121,18 @@ var jiraTests = []linkTest{
"Comment url replacement",
autolink.Autolink{
Pattern: "(https://mattermost.atlassian.net/browse/)(?P<project_id>\\w+)(-)(?P<jira_id>\\d+)[?](focusedCommentId)(=)(?P<comment_id>\\d+)",
Template: "[${project_id}-${jira_id} With Comment #${comment_id}](https://mattermost.atlassian.net/browse/${project_id}-${jira_id}?focusedCommentId=${comment_id})",
Template: "[${project_id}-${jira_id} (comment)](https://mattermost.atlassian.net/browse/${project_id}-${jira_id}?focusedCommentId=${comment_id})",
},
"Welcome https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210 should link!",
"Welcome [MM-12345 With Comment #10210](https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210) should link!",
"Welcome [MM-12345 (comment)](https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210) should link!",
}, {
"Comment url replacement multiple times",
autolink.Autolink{
Pattern: "(https://mattermost.atlassian.net/browse/)(?P<project_id>\\w+)(-)(?P<jira_id>\\d+)[?](focusedCommentId)(=)(?P<comment_id>\\d+)",
Template: "[${project_id}-${jira_id} With Comment #${comment_id}](https://mattermost.atlassian.net/browse/${project_id}-${jira_id}?focusedCommentId=${comment_id})",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change:

Template: "[${project_id}-${jira_id} (comment)](https://mattermost.atlassian.net/browse/${project_id}-${jira_id}?focusedCommentId=${comment_id})",

},
"Welcome https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210. should link https://mattermost.atlassian.net/browse/MM-12346?focusedCommentId=10210 !",
"Welcome [MM-12345 With Comment #10210](https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210). should link [MM-12346 With Comment #10210](https://mattermost.atlassian.net/browse/MM-12346?focusedCommentId=10210) !",
"Welcome https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210. should link https://mattermost.atlassian.net/browse/MM-12346?focusedCommentId=10210!",
sibasankarnayak marked this conversation as resolved.
Show resolved Hide resolved
"Welcome [MM-12345 With Comment #10210](https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210). should link [MM-12346 With Comment #10210](https://mattermost.atlassian.net/browse/MM-12346?focusedCommentId=10210)!",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change:

"Welcome [MM-12345 (comment)](https://mattermost.atlassian.net/browse/MM-12345?focusedCommentId=10210). should link [MM-12346 (comment)](https://mattermost.atlassian.net/browse/MM-12346?focusedCommentId=10210)!",

}, {
"Comment url replacement multiple times and at beginning",
autolink.Autolink{
Expand Down