assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo):[test](http://localhost:3000/test/repo/src/branch/test)] branch created by user1",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>:<a href="http://localhost:3000/test/repo/src/branch/test">test</a>] branch created by user1`,pl.(*MatrixPayloadUnsafe).FormattedBody)
})
t.Run("Delete",func(t*testing.T){
p:=deleteTestPayload()
d:=new(MatrixPayloadUnsafe)
pl,err:=d.Delete(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo):test] branch deleted by user1",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>:test] branch deleted by user1`,pl.(*MatrixPayloadUnsafe).FormattedBody)
})
t.Run("Fork",func(t*testing.T){
p:=forkTestPayload()
d:=new(MatrixPayloadUnsafe)
pl,err:=d.Fork(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[test/repo2](http://localhost:3000/test/repo2) is forked to [test/repo](http://localhost:3000/test/repo)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`<a href="http://localhost:3000/test/repo2">test/repo2</a> is forked to <a href="http://localhost:3000/test/repo">test/repo</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] Issue opened: [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] Issue opened: <a href="http://localhost:3000/test/repo/issues/2">#2 crash</a> by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
p.Action=api.HookIssueClosed
pl,err=d.Issue(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] Issue closed: [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] Issue closed: <a href="http://localhost:3000/test/repo/issues/2">#2 crash</a> by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
})
t.Run("IssueComment",func(t*testing.T){
p:=issueCommentTestPayload()
d:=new(MatrixPayloadUnsafe)
pl,err:=d.IssueComment(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] New comment on issue [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] New comment on issue <a href="http://localhost:3000/test/repo/issues/2">#2 crash</a> by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
})
t.Run("PullRequest",func(t*testing.T){
p:=pullRequestTestPayload()
d:=new(MatrixPayloadUnsafe)
pl,err:=d.PullRequest(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] Pull request opened: [#12 Fix bug](http://localhost:3000/test/repo/pulls/12) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] New comment on pull request [#12 Fix bug](http://localhost:3000/test/repo/pulls/12) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] New comment on pull request <a href="http://localhost:3000/test/repo/pulls/12">#12 Fix bug</a> by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
assert.Equal(t,`[[test/repo](http://localhost:3000/test/repo)] Repository created by [user1](https://try.gitea.io/user1)`,pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] Repository created by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)
})
t.Run("Release",func(t*testing.T){
p:=pullReleaseTestPayload()
d:=new(MatrixPayloadUnsafe)
pl,err:=d.Release(p)
require.NoError(t,err)
require.NotNil(t,pl)
require.IsType(t,&MatrixPayloadUnsafe{},pl)
assert.Equal(t,"[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/src/v1.0) by [user1](https://try.gitea.io/user1)",pl.(*MatrixPayloadUnsafe).Body)
assert.Equal(t,`[<a href="http://localhost:3000/test/repo">test/repo</a>] Release created: <a href="http://localhost:3000/test/repo/src/v1.0">v1.0</a> by <a href="https://try.gitea.io/user1">user1</a>`,pl.(*MatrixPayloadUnsafe).FormattedBody)