summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJosh Adams <josh.rubyist@gmail.com>2016-09-12 12:23:45 -0500
committerPaul Schoenfelder <paulschoenfelder@gmail.com>2016-09-12 12:26:13 -0500
commit4539c8f5f81c11389a6d1d14525fcf5152f0a181 (patch)
treecc33b7d22ac55cd3e4a9fb7dbfd9bc12a5fa3580 /test
parentUpdate .travis.yml (diff)
Add failing test for Slack IRC bridge. See #52
Diffstat (limited to 'test')
-rw-r--r--test/utils_test.exs21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/utils_test.exs b/test/utils_test.exs
index 835af64..c7fb6c5 100644
--- a/test/utils_test.exs
+++ b/test/utils_test.exs
@@ -54,4 +54,25 @@ defmodule ExIrc.UtilsTest do
} = Utils.isup(parsed.args, state)
end
+ test "Parse Slack's inappropriate RPL_TOPIC message as if it were an RPL_NOTOPIC" do
+ # NOTE: This is not a valid message per the RFC. If there's no topic
+ # (which is the case for Slack in this instance), they should instead send
+ # us a RPL_NOTOPIC (331).
+ #
+ # Two things:
+ #
+ # 1) Bad slack! Read your RFCs! (because my code has never had bugs yup obv)
+ # 2) Don't care, still want to talk to them without falling over dead!
+ #
+ # Parsing this as if it were actually an RPL_NOTOPIC (331) seems especially like
+ # a good idea when I realized that there's nothing in ExIRc that does anything
+ # with 331 at all - they just fall on the floor, no crashes to be seen (ideally)
+ message = ':irc.tinyspeck.com 332 jadams #elm-playground-news :'
+ assert %IrcMessage{
+ :nick => "jadams",
+ :cmd => "331",
+ :args => ["#elm-playground-news", "No topic is set"]
+ } = Utils.parse(message)
+ end
+
end