WebPush: Return proper values for jobs.
This commit is contained in:
parent
3c828016d9
commit
f719a5b23a
2 changed files with 4 additions and 3 deletions
|
@ -55,11 +55,12 @@ def perform(
|
||||||
|> Jason.encode!()
|
|> Jason.encode!()
|
||||||
|> push_message(build_sub(subscription), gcm_api_key, subscription)
|
|> push_message(build_sub(subscription), gcm_api_key, subscription)
|
||||||
end
|
end
|
||||||
|
|> (&{:ok, &1}).()
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(_) do
|
def perform(_) do
|
||||||
Logger.warn("Unknown notification type")
|
Logger.warn("Unknown notification type")
|
||||||
:error
|
{:error, :unknown_type}
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc "Push message to web"
|
@doc "Push message to web"
|
||||||
|
|
|
@ -63,12 +63,12 @@ test "performs sending notifications" do
|
||||||
activity: activity
|
activity: activity
|
||||||
)
|
)
|
||||||
|
|
||||||
assert Impl.perform(notif) == [:ok, :ok]
|
assert Impl.perform(notif) == {:ok, [:ok, :ok]}
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag capture_log: true
|
@tag capture_log: true
|
||||||
test "returns error if notif does not match " do
|
test "returns error if notif does not match " do
|
||||||
assert Impl.perform(%{}) == :error
|
assert Impl.perform(%{}) == {:error, :unknown_type}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "successful message sending" do
|
test "successful message sending" do
|
||||||
|
|
Loading…
Reference in a new issue