Fix tests
This commit is contained in:
parent
6cec54f8cc
commit
42574ca847
|
@ -75,7 +75,7 @@ func TestLogoutAction(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRegister(t *testing.T) {
|
func TestRegister(t *testing.T) {
|
||||||
AssertRegexMatch(t, BuildRegister(), RegexRegister, nil)
|
AssertRegexMatch(t, BuildRegister(""), RegexRegister, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRegistrationSuccess(t *testing.T) {
|
func TestRegistrationSuccess(t *testing.T) {
|
||||||
|
@ -83,7 +83,7 @@ func TestRegistrationSuccess(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmailConfirmation(t *testing.T) {
|
func TestEmailConfirmation(t *testing.T) {
|
||||||
AssertRegexMatch(t, BuildEmailConfirmation("mruser", "test_token"), RegexEmailConfirmation, map[string]string{"username": "mruser", "token": "test_token"})
|
AssertRegexMatch(t, BuildEmailConfirmation("mruser", "test_token", ""), RegexEmailConfirmation, map[string]string{"username": "mruser", "token": "test_token"})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPasswordReset(t *testing.T) {
|
func TestPasswordReset(t *testing.T) {
|
||||||
|
@ -370,6 +370,26 @@ func TestJamIndex(t *testing.T) {
|
||||||
AssertSubdomain(t, BuildJamIndex(), "")
|
AssertSubdomain(t, BuildJamIndex(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestJamIndex2021(t *testing.T) {
|
||||||
|
AssertRegexMatch(t, BuildJamIndex2021(), RegexJamIndex2021, nil)
|
||||||
|
AssertSubdomain(t, BuildJamIndex2021(), "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJamIndex2022(t *testing.T) {
|
||||||
|
AssertRegexMatch(t, BuildJamIndex2022(), RegexJamIndex2022, nil)
|
||||||
|
AssertSubdomain(t, BuildJamIndex2022(), "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJamFeed2022(t *testing.T) {
|
||||||
|
AssertRegexMatch(t, BuildJamFeed2022(), RegexJamFeed2022, nil)
|
||||||
|
AssertSubdomain(t, BuildJamFeed2022(), "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProjectNewJam(t *testing.T) {
|
||||||
|
AssertRegexMatch(t, BuildProjectNewJam(), RegexProjectNew, nil)
|
||||||
|
AssertSubdomain(t, BuildProjectNewJam(), "")
|
||||||
|
}
|
||||||
|
|
||||||
func TestDiscordOAuthCallback(t *testing.T) {
|
func TestDiscordOAuthCallback(t *testing.T) {
|
||||||
AssertRegexMatch(t, BuildDiscordOAuthCallback(), RegexDiscordOAuthCallback, nil)
|
AssertRegexMatch(t, BuildDiscordOAuthCallback(), RegexDiscordOAuthCallback, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,27 +61,6 @@ func main() {
|
||||||
assert.Contains(t, html, "Hello, world!")
|
assert.Contains(t, html, "Hello, world!")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("education", func(t *testing.T) {
|
|
||||||
t.Run("[glossary]", func(t *testing.T) {
|
|
||||||
html := ParseMarkdown("[glossary=foo]Foo Protocol[/glossary]", EducationRealMarkdown)
|
|
||||||
t.Log(html)
|
|
||||||
assert.Equal(t, 1, strings.Count(html, "<a"))
|
|
||||||
assert.Contains(t, html, `class="glossary-term"`)
|
|
||||||
assert.Contains(t, html, `data-term="foo"`)
|
|
||||||
})
|
|
||||||
t.Run("[note]", func(t *testing.T) {
|
|
||||||
html := ParseMarkdown("[note]This should only appear to editors![/note]", EducationRealMarkdown)
|
|
||||||
t.Log(html)
|
|
||||||
assert.Equal(t, 1, strings.Count(html, "<div"))
|
|
||||||
assert.Contains(t, html, `class="education-note"`)
|
|
||||||
})
|
|
||||||
t.Run("[resource]", func(t *testing.T) {
|
|
||||||
html := ParseMarkdown(`[resource name="cool name" url="blep"]Excellent description.[/resource]`, EducationRealMarkdown)
|
|
||||||
t.Log(html)
|
|
||||||
t.Fail()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSharlock(t *testing.T) {
|
func TestSharlock(t *testing.T) {
|
||||||
|
|
|
@ -28,12 +28,14 @@ func TestLogContextErrors(t *testing.T) {
|
||||||
router := &Router{}
|
router := &Router{}
|
||||||
routes := RouteBuilder{
|
routes := RouteBuilder{
|
||||||
Router: router,
|
Router: router,
|
||||||
Middleware: func(h Handler) Handler {
|
Middlewares: []Middleware{
|
||||||
return func(c *RequestContext) (res ResponseData) {
|
func(h Handler) Handler {
|
||||||
c.Logger = &logger
|
return func(c *RequestContext) (res ResponseData) {
|
||||||
defer logContextErrorsMiddleware(c, &res)
|
c.Logger = &logger
|
||||||
return h(c)
|
defer logContextErrorsMiddleware(h)
|
||||||
}
|
return h(c)
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue