@@ -19,7 +19,7 @@ defmodule Slack.SendsTest do
1919
2020 test "send_message sends message formatted to client" do
2121 result = Sends . send_message ( "hello" , "channel" , % { process: nil , client: FakeWebsocketClient } )
22- assert result == { nil , ~s/ {"type ":"message ","text":"hello","channel ":"channel "}/ }
22+ assert result == { nil , ~s/ {"channel ":"channel ","text":"hello","type ":"message "}/ }
2323 end
2424
2525 test "send_message understands #channel names" do
@@ -30,7 +30,7 @@ defmodule Slack.SendsTest do
3030 }
3131
3232 result = Sends . send_message ( "hello" , "#channel" , slack )
33- assert result == { nil , ~s/ {"type ":"message ","text":"hello","channel ":"C456 "}/ }
33+ assert result == { nil , ~s/ {"channel ":"C456 ","text":"hello","type ":"message "}/ }
3434 end
3535
3636 test "send_message understands @user names" do
@@ -42,7 +42,7 @@ defmodule Slack.SendsTest do
4242 }
4343
4444 result = Sends . send_message ( "hello" , "@user" , slack )
45- assert result == { nil , ~s/ {"type ":"message ","text":"hello","channel ":"D789 "}/ }
45+ assert result == { nil , ~s/ {"channel ":"D789 ","text":"hello","type ":"message "}/ }
4646 end
4747
4848 test "send_message understands user ids (Uxxx)" do
@@ -54,7 +54,7 @@ defmodule Slack.SendsTest do
5454 }
5555
5656 result = Sends . send_message ( "hello" , "U123" , slack )
57- assert result == { nil , ~s/ {"type ":"message ","text":"hello","channel ":"D789 "}/ }
57+ assert result == { nil , ~s/ {"channel ":"D789 ","text":"hello","type ":"message "}/ }
5858 end
5959
6060 test "send_message understands user ids (Wxxx)" do
@@ -66,7 +66,7 @@ defmodule Slack.SendsTest do
6666 }
6767
6868 result = Sends . send_message ( "hello" , "W123" , slack )
69- assert result == { nil , ~s/ {"type ":"message ","text":"hello","channel ":"D789 "}/ }
69+ assert result == { nil , ~s/ {"channel ":"D789 ","text":"hello","type ":"message "}/ }
7070 end
7171
7272 test "send_message with a thread attribute includes thread_ts in message to client" do
@@ -78,12 +78,15 @@ defmodule Slack.SendsTest do
7878 }
7979
8080 result = Sends . send_message ( "hello" , "D789" , slack , "1555508888.000100" )
81- assert result == { nil , ~s/ {"type":"message","thread_ts":"1555508888.000100","text":"hello","channel":"D789"}/ }
81+
82+ assert result ==
83+ { nil ,
84+ ~s/ {"channel":"D789","text":"hello","thread_ts":"1555508888.000100","type":"message"}/ }
8285 end
8386
8487 test "indicate_typing sends typing notification to client" do
8588 result = Sends . indicate_typing ( "channel" , % { process: nil , client: FakeWebsocketClient } )
86- assert result == { nil , ~s/ {"type ":"typing ","channel ":"channel "}/ }
89+ assert result == { nil , ~s/ {"channel ":"channel ","type ":"typing "}/ }
8790 end
8891
8992 test "send_ping sends ping to client" do
@@ -93,16 +96,16 @@ defmodule Slack.SendsTest do
9396
9497 test "send_ping with data sends ping + data to client" do
9598 result = Sends . send_ping ( % { foo: :bar } , % { process: nil , client: FakeWebsocketClient } )
96- assert result == { nil , ~s/ {"type ":"ping ","foo ":"bar "}/ }
99+ assert result == { nil , ~s/ {"foo ":"bar ","type ":"ping "}/ }
97100 end
98101
99102 test "subscribe_presence sends presence subscription message to client" do
100103 result = Sends . subscribe_presence ( [ "a_user_id" ] , % { process: nil , client: FakeWebsocketClient } )
101- assert result == { nil , ~s/ {"type":"presence_sub","ids":["a_user_id"] }/ }
104+ assert result == { nil , ~s/ {"ids":["a_user_id"],"type":"presence_sub" }/ }
102105 end
103106
104107 test "subscribe_presence without ids sends presence subscription message to client" do
105108 result = Sends . subscribe_presence ( % { process: nil , client: FakeWebsocketClient } )
106- assert result == { nil , ~s/ {"type":"presence_sub","ids":[] }/ }
109+ assert result == { nil , ~s/ {"ids":[],"type":"presence_sub" }/ }
107110 end
108111end
0 commit comments