test: Change lenght(…) == 0
to Enum.empty?(…)
This commit is contained in:
parent
8bb7e19b38
commit
74579115a7
@ -197,7 +197,7 @@ defmodule Pleroma.FormatterTest do
|
||||
|
||||
{subs, text} = Formatter.add_user_links({[], text}, mentions)
|
||||
|
||||
assert length(subs) == 0
|
||||
assert Enum.empty?(subs)
|
||||
Enum.each(subs, fn {uuid, _} -> assert String.contains?(text, uuid) end)
|
||||
|
||||
expected_text = "@a hi"
|
||||
|
@ -300,7 +300,7 @@ defmodule Pleroma.NotificationTest 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)
|
||||
|
||||
@ -308,7 +308,7 @@ defmodule Pleroma.NotificationTest do
|
||||
|
||||
{: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
|
||||
@ -317,7 +317,7 @@ defmodule Pleroma.NotificationTest 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)
|
||||
|
||||
@ -325,7 +325,7 @@ defmodule Pleroma.NotificationTest do
|
||||
|
||||
{: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
|
||||
@ -334,7 +334,7 @@ defmodule Pleroma.NotificationTest 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)
|
||||
|
||||
@ -342,7 +342,7 @@ defmodule Pleroma.NotificationTest do
|
||||
|
||||
{: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
|
||||
@ -351,7 +351,7 @@ defmodule Pleroma.NotificationTest 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)
|
||||
|
||||
@ -359,7 +359,7 @@ defmodule Pleroma.NotificationTest do
|
||||
|
||||
{: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
|
||||
@ -368,15 +368,15 @@ defmodule Pleroma.NotificationTest 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
|
||||
@ -385,15 +385,15 @@ defmodule Pleroma.NotificationTest 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
|
||||
@ -409,7 +409,7 @@ defmodule Pleroma.NotificationTest 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
|
||||
|
@ -151,7 +151,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||
assert message =~ "Successfully unsubscribed"
|
||||
|
||||
user = User.get_by_nickname(user.nickname)
|
||||
assert length(user.following) == 0
|
||||
assert Enum.empty?(user.following)
|
||||
assert user.info.deactivated
|
||||
end
|
||||
|
||||
|
@ -36,7 +36,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||
|> assign(:user, user)
|
||||
|> get("/api/v1/timelines/home")
|
||||
|
||||
assert length(json_response(conn, 200)) == 0
|
||||
assert Enum.empty?(json_response(conn, 200))
|
||||
|
||||
{:ok, user} = User.follow(user, following)
|
||||
|
||||
|
@ -81,7 +81,7 @@ defmodule Pleroma.Web.Websub.WebsubControllerTest do
|
||||
|
||||
assert response(conn, 500) == "Error"
|
||||
|
||||
assert length(Repo.all(Activity)) == 0
|
||||
assert Enum.empty?(Repo.all(Activity))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user