diff options
-rw-r--r-- | test/polyjuice/client_test.exs | 36 |
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 |