Skip to content

Commit a660281

Browse files
committed
fix tests
1 parent 46def44 commit a660281

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

modules/markup/html_internal_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
const (
2020
TestAppURL = "http://localhost:3000/"
21-
TestRepoURL = TestAppURL + "owner/repo/"
21+
TestRepoURL = TestAppURL + "test-owner/test-repo/"
2222
)
2323

2424
// externalIssueLink an HTML link to an alphanumeric-style issue
@@ -63,8 +63,8 @@ var regexpMetas = map[string]string{
6363

6464
// these values should match the TestOrgRepo const above
6565
var localMetas = map[string]string{
66-
"user": "gogits",
67-
"repo": "gogs",
66+
"user": "test-owner",
67+
"repo": "test-repo",
6868
}
6969

7070
func TestRender_IssueIndexPattern(t *testing.T) {
@@ -361,12 +361,12 @@ func TestRender_FullIssueURLs(t *testing.T) {
361361
`Look here <a href="http://localhost:3000/person/repo/issues/4" class="ref-issue">person/repo#4</a>`)
362362
test("http://localhost:3000/person/repo/issues/4#issuecomment-1234",
363363
`<a href="http://localhost:3000/person/repo/issues/4#issuecomment-1234" class="ref-issue">person/repo#4 (comment)</a>`)
364-
test("http://localhost:3000/gogits/gogs/issues/4",
365-
`<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a>`)
366-
test("http://localhost:3000/gogits/gogs/issues/4 test",
367-
`<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a> test`)
368-
test("http://localhost:3000/gogits/gogs/issues/4?a=1&b=2#comment-123 test",
369-
`<a href="http://localhost:3000/gogits/gogs/issues/4?a=1&amp;b=2#comment-123" class="ref-issue">#4 (comment)</a> test`)
364+
test("http://localhost:3000/test-owner/test-repo/issues/4",
365+
`<a href="http://localhost:3000/test-owner/test-repo/issues/4" class="ref-issue">#4</a>`)
366+
test("http://localhost:3000/test-owner/test-repo/issues/4 test",
367+
`<a href="http://localhost:3000/test-owner/test-repo/issues/4" class="ref-issue">#4</a> test`)
368+
test("http://localhost:3000/test-owner/test-repo/issues/4?a=1&b=2#comment-123 test",
369+
`<a href="http://localhost:3000/test-owner/test-repo/issues/4?a=1&amp;b=2#comment-123" class="ref-issue">#4 (comment)</a> test`)
370370
test("http://localhost:3000/testOrg/testOrgRepo/pulls/2/files#issuecomment-24",
371371
"http://localhost:3000/testOrg/testOrgRepo/pulls/2/files#issuecomment-24")
372372
test("http://localhost:3000/testOrg/testOrgRepo/pulls/2/files",

modules/markup/html_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func TestRender_CrossReferences(t *testing.T) {
120120
}
121121

122122
test(
123-
"gogits/gogs#12345",
124-
`<p><a href="`+util.URLJoin(markup.TestAppURL, "gogits", "gogs", "issues", "12345")+`" class="ref-issue" rel="nofollow">gogits/gogs#12345</a></p>`)
123+
"test-owner/test-repo#12345",
124+
`<p><a href="`+util.URLJoin(markup.TestAppURL, "gogits", "gogs", "issues", "12345")+`" class="ref-issue" rel="nofollow">test-owner/test-repo#12345</a></p>`)
125125
test(
126126
"go-gitea/gitea#12345",
127127
`<p><a href="`+util.URLJoin(markup.TestAppURL, "go-gitea", "gitea", "issues", "12345")+`" class="ref-issue" rel="nofollow">go-gitea/gitea#12345</a></p>`)
@@ -541,19 +541,19 @@ func TestRender_RelativeImages(t *testing.T) {
541541
return strings.TrimSpace(string(buffer))
542542
}
543543

544-
out := render(`<img src="LINK">`, false, markup.Links{Base: "/owner/repo"})
545-
assert.Equal(t, `<a href="/owner/repo/LINK" target="_blank" rel="nofollow noopener"><img src="/owner/repo/LINK"/></a>`, out)
544+
out := render(`<img src="LINK">`, false, markup.Links{Base: "/test-owner/test-repo"})
545+
assert.Equal(t, `<a href="/test-owner/test-repo/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/LINK"/></a>`, out)
546546

547-
out = render(`<img src="LINK">`, true, markup.Links{Base: "/owner/repo"})
548-
assert.Equal(t, `<a href="/owner/repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/owner/repo/wiki/raw/LINK"/></a>`, out)
547+
out = render(`<img src="LINK">`, true, markup.Links{Base: "/test-owner/test-repo"})
548+
assert.Equal(t, `<a href="/test-owner/test-repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/wiki/raw/LINK"/></a>`, out)
549549

550-
out = render(`<img src="LINK">`, false, markup.Links{Base: "/owner/repo", BranchPath: "master"})
551-
assert.Equal(t, `<a href="/owner/repo/media/master/LINK" target="_blank" rel="nofollow noopener"><img src="/owner/repo/media/master/LINK"/></a>`, out)
550+
out = render(`<img src="LINK">`, false, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"})
551+
assert.Equal(t, `<a href="/test-owner/test-repo/media/test-branch/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/media/test-branch/LINK"/></a>`, out)
552552

553-
out = render(`<img src="LINK">`, true, markup.Links{Base: "/owner/repo", BranchPath: "master"})
554-
assert.Equal(t, `<a href="/owner/repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/owner/repo/wiki/raw/LINK"/></a>`, out)
553+
out = render(`<img src="LINK">`, true, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"})
554+
assert.Equal(t, `<a href="/test-owner/test-repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/wiki/raw/LINK"/></a>`, out)
555555

556-
out = render(`<img src="/LINK">`, true, markup.Links{Base: "/owner/repo", BranchPath: "master"})
556+
out = render(`<img src="/LINK">`, true, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"})
557557
assert.Equal(t, `<img src="/LINK"/>`, out)
558558
}
559559

0 commit comments

Comments
 (0)