aboutsummaryrefslogtreecommitdiffstats
path: root/modules/webhook/matrix_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webhook/matrix_test.go')
-rw-r--r--modules/webhook/matrix_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/webhook/matrix_test.go b/modules/webhook/matrix_test.go
index 4e8b878ad4..3d1c660126 100644
--- a/modules/webhook/matrix_test.go
+++ b/modules/webhook/matrix_test.go
@@ -154,3 +154,32 @@ func TestMatrixHookRequest(t *testing.T) {
assert.Equal(t, "Bearer dummy_access_token", req.Header.Get("Authorization"))
assert.Equal(t, wantPayloadContent, h.PayloadContent)
}
+
+func Test_getTxnID(t *testing.T) {
+ type args struct {
+ payload []byte
+ }
+ tests := []struct {
+ name string
+ args args
+ want string
+ wantErr bool
+ }{
+ {
+ name: "dummy payload",
+ args: args{payload: []byte("Hello World")},
+ want: "0a4d55a8d778e5022fab701977c5d840bbc486d0",
+ wantErr: false,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := getMatrixTxnID(tt.args.payload)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("getMatrixTxnID() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ assert.Equal(t, tt.want, got)
+ })
+ }
+}