assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>:<http://localhost:3000/test/repo/src/branch/test|test>] branch created by user1",pl.(*SlackPayload).Text)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>:<http://localhost:3000/test/repo/src/branch/test|test>] 2 new commits pushed by user1",pl.(*SlackPayload).Text)
})
t.Run("Issue",func(t*testing.T){
p:=issueTestPayload()
d:=new(SlackPayload)
p.Action=api.HookIssueOpened
pl,err:=d.Issue(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&SlackPayload{},pl)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>] Issue opened: <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>",pl.(*SlackPayload).Text)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>] Issue closed: <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>", pl.(*SlackPayload).Text)
})
t.Run("IssueComment",func(t*testing.T){
p:=issueCommentTestPayload()
d:=new(SlackPayload)
pl,err:=d.IssueComment(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&SlackPayload{},pl)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>] New comment on issue <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>",pl.(*SlackPayload).Text)
})
t.Run("PullRequest",func(t*testing.T){
p:=pullRequestTestPayload()
d:=new(SlackPayload)
pl,err:=d.PullRequest(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&SlackPayload{},pl)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>] Pull request opened: <http://localhost:3000/test/repo/pulls/12|#12 Fix bug> by <https://try.gitea.io/user1|user1>",pl.(*SlackPayload).Text)
})
t.Run("PullRequestComment",func(t*testing.T){
p:=pullRequestCommentTestPayload()
d:=new(SlackPayload)
pl,err:=d.IssueComment(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&SlackPayload{},pl)
assert.Equal(t,"[<http://localhost:3000/test/repo|test/repo>] New comment on pull request <http://localhost:3000/test/repo/pulls/12|#12 Fix bug> by <https://try.gitea.io/user1|user1>",pl.(*SlackPayload).Text)