File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
defmodule WebPushEncryption.Mixfile do
2
2
use Mix.Project
3
3
4
- @ version "0.2.1 "
4
+ @ version "0.2.2 "
5
5
6
6
def project do
7
7
[
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ ExUnit.start()
2
2
3
3
defmodule Fixtures do
4
4
@ gcm_url "https://android.googleapis.com/gcm/send"
5
+ @ fcm_url "https://fcm.googleapis.com/fcm/send"
5
6
6
7
def example_input ( ) , do: "Hello, World."
7
8
def example_output ( ) , do: "CE2OS6BxfXsC2YbTdfkeWLlt4AKWbHZ3Fe53n5/4Yg=="
@@ -28,6 +29,10 @@ defmodule Fixtures do
28
29
def valid_gcm_subscription ( ) do
29
30
Map . put ( valid_subscription ( ) , :endpoint , @ gcm_url )
30
31
end
32
+
33
+ def valid_fcm_subscription ( ) do
34
+ Map . put ( valid_subscription ( ) , :endpoint , @ fcm_url )
35
+ end
31
36
end
32
37
33
38
defmodule HTTPoisonSandbox do
Original file line number Diff line number Diff line change @@ -28,4 +28,15 @@ defmodule WebPushEncryption.PushTest do
28
28
Push . send_web_push ( Fixtures . example_input ( ) , Fixtures . valid_gcm_subscription ( ) , "auth_token" )
29
29
assert Enum . count ( HTTPoisonSandbox . requests ( ) ) == 1
30
30
end
31
+
32
+ test "fcm endpoint without auth_token" do
33
+ assert_raise ArgumentError , fn ->
34
+ Push . send_web_push ( Fixtures . example_input ( ) , Fixtures . valid_fcm_subscription ( ) )
35
+ end
36
+ end
37
+
38
+ test "fcm endpoint with auth_token" do
39
+ Push . send_web_push ( Fixtures . example_input ( ) , Fixtures . valid_fcm_subscription ( ) , "auth_token" )
40
+ assert Enum . count ( HTTPoisonSandbox . requests ( ) ) == 1
41
+ end
31
42
end
You can’t perform that action at this time.
0 commit comments