@@ -53,6 +53,12 @@ var alphanumericMetas = map[string]string{
5353 "style" : IssueNameStyleAlphanumeric ,
5454}
5555
56+ // these values should match the Repo const above
57+ var localMetas = map [string ]string {
58+ "user" : "gogits" ,
59+ "repo" : "gogs" ,
60+ }
61+
5662func TestRender_IssueIndexPattern (t * testing.T ) {
5763 // numeric: render inputs without valid mentions
5864 test := func (s string ) {
@@ -90,7 +96,7 @@ func TestRender_IssueIndexPattern2(t *testing.T) {
9096 links [i ] = numericIssueLink (util .URLJoin (setting .AppSubURL , "issues" ), index )
9197 }
9298 expectedNil := fmt .Sprintf (expectedFmt , links ... )
93- testRenderIssueIndexPattern (t , s , expectedNil , nil )
99+ testRenderIssueIndexPattern (t , s , expectedNil , & postProcessCtx { metas : localMetas } )
94100
95101 for i , index := range indices {
96102 links [i ] = numericIssueLink ("https://someurl.com/someUser/someRepo/" , index )
@@ -168,6 +174,7 @@ func testRenderIssueIndexPattern(t *testing.T, input, expected string, ctx *post
168174 if ctx .urlPrefix == "" {
169175 ctx .urlPrefix = AppSubURL
170176 }
177+
171178 res , err := ctx .postProcess ([]byte (input ))
172179 assert .NoError (t , err )
173180 assert .Equal (t , expected , string (res ))
@@ -178,10 +185,10 @@ func TestRender_AutoLink(t *testing.T) {
178185 setting .AppSubURL = AppSubURL
179186
180187 test := func (input , expected string ) {
181- buffer , err := PostProcess ([]byte (input ), setting .AppSubURL , nil , false )
188+ buffer , err := PostProcess ([]byte (input ), setting .AppSubURL , localMetas , false )
182189 assert .Equal (t , err , nil )
183190 assert .Equal (t , strings .TrimSpace (expected ), strings .TrimSpace (string (buffer )))
184- buffer , err = PostProcess ([]byte (input ), setting .AppSubURL , nil , true )
191+ buffer , err = PostProcess ([]byte (input ), setting .AppSubURL , localMetas , true )
185192 assert .Equal (t , err , nil )
186193 assert .Equal (t , strings .TrimSpace (expected ), strings .TrimSpace (string (buffer )))
187194 }
@@ -211,6 +218,7 @@ func TestRender_FullIssueURLs(t *testing.T) {
211218 if ctx .urlPrefix == "" {
212219 ctx .urlPrefix = AppSubURL
213220 }
221+ ctx .metas = localMetas
214222 result , err := ctx .postProcess ([]byte (input ))
215223 assert .NoError (t , err )
216224 assert .Equal (t , expected , string (result ))
0 commit comments