-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from edgurgel/validate-pusher-event
Validate pusher event
- Loading branch information
Showing
7 changed files
with
118 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule Poxa.Integration.TriggerEvent do | ||
use ExUnit.Case, async: true | ||
|
||
@moduletag :integration | ||
|
||
setup_all do | ||
Application.ensure_all_started(:pusher) | ||
Pusher.configure!("localhost", 8080, "app_id", "app_key", "secret") | ||
:ok | ||
end | ||
|
||
test "trigger event returns 200" do | ||
[channel, socket_id] = ["channel", "123.456"] | ||
|
||
assert Pusher.trigger("test_event", %{}, channel, socket_id) == 200 | ||
end | ||
|
||
test "trigger event returns 400 on invalid channel" do | ||
[channel, socket_id] = ["channel:invalid", "123.456"] | ||
|
||
assert Pusher.trigger("test_event", %{}, channel, socket_id) == 400 | ||
end | ||
|
||
test "trigger event returns 400 on invalid socket_id" do | ||
[channel, socket_id] = ["channel", "123456"] | ||
|
||
assert Pusher.trigger("test_event", %{}, channel, socket_id) == 400 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters