diff options
| author | Zeyla Hellyer <[email protected]> | 2017-04-27 17:04:13 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-04-27 17:04:13 -0700 |
| commit | 822a4fe9d369f942948fafe5b8b8b8a869116ccb (patch) | |
| tree | 45ff36071232745cfc4ca26b6d5337bb14cf3fda /tests | |
| parent | Add `is_nsfw` check to channels (diff) | |
| download | serenity-822a4fe9d369f942948fafe5b8b8b8a869116ccb.tar.xz serenity-822a4fe9d369f942948fafe5b8b8b8a869116ccb.zip | |
Fix non-custom emoji deserialization
Deserializing a non-custom emoji would fail, as an Id would always be
expected.
To fix this, special-case that if a name and id are both present, to
deserialize it as a Custom emoji reaction. Otherwise, use only the name
and deserialize as a basic reaction.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/resources/message_reaction_add_2.json | 1 | ||||
| -rw-r--r-- | tests/resources/message_reaction_remove_2.json | 1 | ||||
| -rw-r--r-- | tests/test_deser.rs | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/tests/resources/message_reaction_add_2.json b/tests/resources/message_reaction_add_2.json new file mode 100644 index 0000000..ed3d807 --- /dev/null +++ b/tests/resources/message_reaction_add_2.json @@ -0,0 +1 @@ +{"user_id":"114941315417899012","message_id":"307288080891772929","emoji":{"name":"👍","id":null},"channel_id":"244567637332328449"} diff --git a/tests/resources/message_reaction_remove_2.json b/tests/resources/message_reaction_remove_2.json new file mode 100644 index 0000000..9c4f106 --- /dev/null +++ b/tests/resources/message_reaction_remove_2.json @@ -0,0 +1 @@ +{"user_id":"71924901186908160","message_id":"306912491836014592","emoji":{"name":"😋","id":null},"channel_id":"110805314659438592"} diff --git a/tests/test_deser.rs b/tests/test_deser.rs index a2d1be7..8216c57 100644 --- a/tests/test_deser.rs +++ b/tests/test_deser.rs @@ -122,11 +122,13 @@ fn message_update() { #[test] fn message_reaction_add() { p!(ReactionAddEvent, "message_reaction_add_1"); + p!(ReactionAddEvent, "message_reaction_add_2"); } #[test] fn message_reaction_remove() { p!(ReactionRemoveEvent, "message_reaction_remove_1"); + p!(ReactionRemoveEvent, "message_reaction_remove_2"); } #[test] |