diff options
author | Alex Auvolat <alex@adnab.me> | 2018-08-27 16:19:53 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-08-27 16:19:53 +0200 |
commit | 233989490b0b01670b03154f9e8f83be13e5a89a (patch) | |
tree | 9a98641848fc57f85ce2c451911d4030c05153f9 /test/conn_test.exs | |
parent | 6cc81b55f2466cd7526f47da6980e3eb47041457 (diff) | |
download | shard-233989490b0b01670b03154f9e8f83be13e5a89a.tar.gz shard-233989490b0b01670b03154f9e8f83be13e5a89a.zip |
Big fixes (1 line), small changes (many lines)
Diffstat (limited to 'test/conn_test.exs')
-rw-r--r-- | test/conn_test.exs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/conn_test.exs b/test/conn_test.exs index ff746b7..d2431d7 100644 --- a/test/conn_test.exs +++ b/test/conn_test.exs @@ -39,4 +39,27 @@ defmodule ShardTest.Conn do {:ok, msg} = Box.open_easy(enc, n, pk, sk) msg end + + + test "set nickname" do + Shard.Identity.set_nickname "test bot" + end + + test "connect to other instance" do + Shard.Manager.add_peer({127, 0, 0, 1}, 4045) + receive do after 100 -> nil end + end + + test "connect to chat rooms" do + {:ok, pid1} = DynamicSupervisor.start_child(Shard.DynamicSupervisor, {SApp.Chat, "test"}) + {:ok, pid2} = DynamicSupervisor.start_child(Shard.DynamicSupervisor, {SApp.Chat, "other_test"}) + GenServer.cast(pid1, {:chat_send, "test msg 1"}) + GenServer.cast(pid2, {:chat_send, "test msg 2"}) + + receive do after 100 -> nil end + {:ok, pid3} = DynamicSupervisor.start_child(Shard.DynamicSupervisor, {SApp.Chat, "test"}) + receive do after 100 -> nil end + assert not Process.alive?(pid3) + end + end |