summaryrefslogtreecommitdiff
path: root/test/polyjuice
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2019-10-06 09:39:38 -0400
committerHubert Chathi <hubert@uhoreg.ca>2019-10-06 09:39:38 -0400
commit2d1483dfde3e96933c23a08d4f4a419d7005267a (patch)
tree8fb138bfdbc14d30287f94cbb627d9dea0f863cd /test/polyjuice
parentadd test for Ets storage (and fix some issues) (diff)
more unit tests
Diffstat (limited to 'test/polyjuice')
-rw-r--r--test/polyjuice/client_test.exs36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/polyjuice/client_test.exs b/test/polyjuice/client_test.exs
index 2fc5ae6..9b35a6d 100644
--- a/test/polyjuice/client_test.exs
+++ b/test/polyjuice/client_test.exs
@@ -83,4 +83,40 @@ defmodule Polyjuice.ClientTest do
end
end
end
+
+ test "send event" do
+ with client = %DummyClient{
+ response: {
+ %Polyjuice.Client.Endpoint.PutRoomsSend{
+ room: "!bar",
+ txn_id: "txn_id",
+ event_type: "m.room.message",
+ message: %{
+ "msgtype" => "m.text",
+ "body" => "foo"
+ }
+ },
+ {:ok, "$foo1"}
+ }
+ } do
+ {:ok, event_id} = Polyjuice.Client.send_event(client, "m.room.message", %{"msgtype" => "m.text", "body" => "foo"}, "!bar")
+ assert event_id == "$foo1"
+ end
+ end
+
+ test "update read receipt" do
+ with client = %DummyClient{
+ response: {
+ %Polyjuice.Client.Endpoint.PostRoomsReceipt{
+ room: "!room",
+ event_id: "$event",
+ receipt_type: "m.read"
+ },
+ {:ok}
+ }
+ } do
+ {:ok} = Polyjuice.Client.update_read_receipt(client, "!room", "$event", "m.read")
+ {:ok} = Polyjuice.Client.update_read_receipt(client, "!room", "$event")
+ end
+ end
end