{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
{:ok, _} = CommonAPI.delete(activity.id, user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "liking an activity results in 1 notification, then 0 if the activity is unliked" do
{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
{:ok, _, _, _} = CommonAPI.unfavorite(activity.id, other_user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "repeating an activity results in 1 notification, then 0 if the activity is deleted" do
{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _, _} = CommonAPI.repeat(activity.id, other_user)
{:ok, _} = CommonAPI.delete(activity.id, user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "repeating an activity results in 1 notification, then 0 if the activity is unrepeated" do
{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _, _} = CommonAPI.repeat(activity.id, other_user)
{:ok, _, _} = CommonAPI.unrepeat(activity.id, other_user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "liking an activity which is already deleted does not generate a notification" do
{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _deletion_activity} = CommonAPI.delete(activity.id, user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:error, _} = CommonAPI.favorite(activity.id, other_user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "repeating an activity which is already deleted does not generate a notification" do
{:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:ok, _deletion_activity} = CommonAPI.delete(activity.id, user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
{:error, _} = CommonAPI.repeat(activity.id, other_user)
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
test "replying to a deleted post without tagging does not generate a notification" do
"in_reply_to_status_id" => activity.id
})
- assert length(Notification.for_user(user)) == 0
+ assert Enum.empty?(Notification.for_user(user))
end
end
end