summaryrefslogtreecommitdiffstats
path: root/services/webhook/telegram_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/webhook/telegram_test.go')
-rw-r--r--services/webhook/telegram_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/services/webhook/telegram_test.go b/services/webhook/telegram_test.go
index 2f83090166..5ca78d0508 100644
--- a/services/webhook/telegram_test.go
+++ b/services/webhook/telegram_test.go
@@ -145,6 +145,35 @@ func TestTelegramPayload(t *testing.T) {
assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] Repository created`, pl.(*TelegramPayload).Message)
})
+ t.Run("Wiki", func(t *testing.T) {
+ p := wikiTestPayload()
+
+ d := new(TelegramPayload)
+ p.Action = api.HookWikiCreated
+ pl, err := d.Wiki(p)
+ require.NoError(t, err)
+ require.NotNil(t, pl)
+ require.IsType(t, &TelegramPayload{}, pl)
+
+ assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] New wiki page '<a href="http://localhost:3000/test/repo/wiki/index">index</a>' (Wiki change comment) by <a href="https://try.gitea.io/user1">user1</a>`, pl.(*TelegramPayload).Message)
+
+ p.Action = api.HookWikiEdited
+ pl, err = d.Wiki(p)
+ require.NoError(t, err)
+ require.NotNil(t, pl)
+ require.IsType(t, &TelegramPayload{}, pl)
+
+ assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] Wiki page '<a href="http://localhost:3000/test/repo/wiki/index">index</a>' edited (Wiki change comment) by <a href="https://try.gitea.io/user1">user1</a>`, pl.(*TelegramPayload).Message)
+
+ p.Action = api.HookWikiDeleted
+ pl, err = d.Wiki(p)
+ require.NoError(t, err)
+ require.NotNil(t, pl)
+ require.IsType(t, &TelegramPayload{}, pl)
+
+ assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] Wiki page '<a href="http://localhost:3000/test/repo/wiki/index">index</a>' deleted by <a href="https://try.gitea.io/user1">user1</a>`, pl.(*TelegramPayload).Message)
+ })
+
t.Run("Release", func(t *testing.T) {
p := pullReleaseTestPayload()