|
|
@ -96,12 +96,14 @@ func TestRender_IssueIndexPattern2(t *testing.T) { |
|
|
|
// numeric: render inputs with valid mentions
|
|
|
|
// numeric: render inputs with valid mentions
|
|
|
|
test := func(s, expectedFmt, marker string, indices ...int) { |
|
|
|
test := func(s, expectedFmt, marker string, indices ...int) { |
|
|
|
var path, prefix string |
|
|
|
var path, prefix string |
|
|
|
|
|
|
|
isExternal := false |
|
|
|
if marker == "!" { |
|
|
|
if marker == "!" { |
|
|
|
path = "pulls" |
|
|
|
path = "pulls" |
|
|
|
prefix = "http://localhost:3000/someUser/someRepo/pulls/" |
|
|
|
prefix = "http://localhost:3000/someUser/someRepo/pulls/" |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
path = "issues" |
|
|
|
path = "issues" |
|
|
|
prefix = "https://someurl.com/someUser/someRepo/" |
|
|
|
prefix = "https://someurl.com/someUser/someRepo/" |
|
|
|
|
|
|
|
isExternal = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
links := make([]interface{}, len(indices)) |
|
|
|
links := make([]interface{}, len(indices)) |
|
|
@ -111,8 +113,13 @@ func TestRender_IssueIndexPattern2(t *testing.T) { |
|
|
|
expectedNil := fmt.Sprintf(expectedFmt, links...) |
|
|
|
expectedNil := fmt.Sprintf(expectedFmt, links...) |
|
|
|
testRenderIssueIndexPattern(t, s, expectedNil, &RenderContext{Metas: localMetas}) |
|
|
|
testRenderIssueIndexPattern(t, s, expectedNil, &RenderContext{Metas: localMetas}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class := "ref-issue" |
|
|
|
|
|
|
|
if isExternal { |
|
|
|
|
|
|
|
class += " ref-external-issue" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for i, index := range indices { |
|
|
|
for i, index := range indices { |
|
|
|
links[i] = numericIssueLink(prefix, "ref-issue", index, marker) |
|
|
|
links[i] = numericIssueLink(prefix, class, index, marker) |
|
|
|
} |
|
|
|
} |
|
|
|
expectedNum := fmt.Sprintf(expectedFmt, links...) |
|
|
|
expectedNum := fmt.Sprintf(expectedFmt, links...) |
|
|
|
testRenderIssueIndexPattern(t, s, expectedNum, &RenderContext{Metas: numericMetas}) |
|
|
|
testRenderIssueIndexPattern(t, s, expectedNum, &RenderContext{Metas: numericMetas}) |
|
|
@ -178,7 +185,7 @@ func TestRender_IssueIndexPattern4(t *testing.T) { |
|
|
|
test := func(s, expectedFmt string, names ...string) { |
|
|
|
test := func(s, expectedFmt string, names ...string) { |
|
|
|
links := make([]interface{}, len(names)) |
|
|
|
links := make([]interface{}, len(names)) |
|
|
|
for i, name := range names { |
|
|
|
for i, name := range names { |
|
|
|
links[i] = alphanumIssueLink("https://someurl.com/someUser/someRepo/", "ref-issue", name) |
|
|
|
links[i] = alphanumIssueLink("https://someurl.com/someUser/someRepo/", "ref-issue ref-external-issue", name) |
|
|
|
} |
|
|
|
} |
|
|
|
expected := fmt.Sprintf(expectedFmt, links...) |
|
|
|
expected := fmt.Sprintf(expectedFmt, links...) |
|
|
|
testRenderIssueIndexPattern(t, s, expected, &RenderContext{Metas: alphanumericMetas}) |
|
|
|
testRenderIssueIndexPattern(t, s, expected, &RenderContext{Metas: alphanumericMetas}) |
|
|
|