diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-11-14 01:11:40 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-11-14 01:11:40 +0200 |
commit | 912bf309d1f102f8f10c96c718784f01901dad4d (patch) | |
tree | d39b4dc6723884d49e6576411f494d56f492df30 /matrix/pushrules/rule_array_test.go | |
parent | a0815a6f3de6ed4063fcdcf6c7af3f946bbf52f8 (diff) |
Fix tests
Diffstat (limited to 'matrix/pushrules/rule_array_test.go')
-rw-r--r-- | matrix/pushrules/rule_array_test.go | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/matrix/pushrules/rule_array_test.go b/matrix/pushrules/rule_array_test.go index 9396411..5a5bd3d 100644 --- a/matrix/pushrules/rule_array_test.go +++ b/matrix/pushrules/rule_array_test.go @@ -19,6 +19,7 @@ package pushrules_test import ( "github.com/stretchr/testify/assert" "maunium.net/go/gomuks/matrix/pushrules" + "maunium.net/go/mautrix" "testing" ) @@ -61,9 +62,9 @@ func TestPushRuleArray_GetActions_FirstMatchReturns(t *testing.T) { rules := pushrules.PushRuleArray{rule1, rule2, rule3} - event := newFakeEvent("m.room.message", map[string]interface{}{ - "msgtype": "m.emote", - "body": "is testing pushrules", + event := newFakeEvent(mautrix.EventMessage, mautrix.Content{ + MsgType: mautrix.MsgEmote, + Body: "is testing pushrules", }) assert.Equal(t, rules.GetActions(blankTestRoom, event), actions2) } @@ -107,9 +108,9 @@ func TestPushRuleArray_GetActions_NoMatchesIsNil(t *testing.T) { rules := pushrules.PushRuleArray{rule1, rule2, rule3} - event := newFakeEvent("m.room.message", map[string]interface{}{ - "msgtype": "m.emote", - "body": "is testing pushrules", + event := newFakeEvent(mautrix.EventMessage, mautrix.Content{ + MsgType: mautrix.MsgEmote, + Body: "is testing pushrules", }) assert.Nil(t, rules.GetActions(blankTestRoom, event)) } @@ -156,9 +157,9 @@ func TestPushRuleMap_GetActions_RoomRuleExists(t *testing.T) { Type: pushrules.RoomRule, } - event := newFakeEvent("m.room.message", map[string]interface{}{ - "msgtype": "m.emote", - "body": "is testing pushrules", + event := newFakeEvent(mautrix.EventMessage, mautrix.Content{ + MsgType: mautrix.MsgEmote, + Body: "is testing pushrules", }) assert.Equal(t, rules.GetActions(blankTestRoom, event), actions3) } @@ -194,9 +195,9 @@ func TestPushRuleMap_GetActions_RoomRuleDoesntExist(t *testing.T) { Type: pushrules.RoomRule, } - event := newFakeEvent("m.room.message", map[string]interface{}{ - "msgtype": "m.emote", - "body": "is testing pushrules", + event := newFakeEvent(mautrix.EventMessage, mautrix.Content{ + MsgType: mautrix.MsgEmote, + Body: "is testing pushrules", }) assert.Nil(t, rules.GetActions(blankTestRoom, event)) } @@ -243,9 +244,9 @@ func TestPushRuleMap_GetActions_SenderRuleExists(t *testing.T) { Type: pushrules.SenderRule, } - event := newFakeEvent("m.room.message", map[string]interface{}{ - "msgtype": "m.emote", - "body": "is testing pushrules", + event := newFakeEvent(mautrix.EventMessage, mautrix.Content{ + MsgType: mautrix.MsgEmote, + Body: "is testing pushrules", }) assert.Equal(t, rules.GetActions(blankTestRoom, event), actions1) } |