1
0
Fork 0
forked from mirrors/akkoma

test: Change lenght(…) == 0 to Enum.empty?(…)

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-02-11 00:08:48 +01:00
parent 8bb7e19b38
commit 74579115a7
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
5 changed files with 19 additions and 19 deletions

View file

@ -197,7 +197,7 @@ test "does not give a replacement for single-character local nicknames who don't
{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"

View file

@ -300,7 +300,7 @@ test "liking an activity results in 1 notification, then 0 if the activity is de
{: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 @@ test "liking an activity results in 1 notification, then 0 if the activity is de
{: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 @@ test "liking an activity results in 1 notification, then 0 if the activity is un
{: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 @@ test "liking an activity results in 1 notification, then 0 if the activity is un
{: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 @@ test "repeating an activity results in 1 notification, then 0 if the activity is
{: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 @@ test "repeating an activity results in 1 notification, then 0 if the activity is
{: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 @@ test "repeating an activity results in 1 notification, then 0 if the activity is
{: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 @@ test "repeating an activity results in 1 notification, then 0 if the activity is
{: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 @@ test "liking an activity which is already deleted does not generate a notificati
{: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 @@ test "repeating an activity which is already deleted does not generate a notific
{: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 @@ test "replying to a deleted post without tagging does not generate a notificatio
"in_reply_to_status_id" => activity.id
})
assert length(Notification.for_user(user)) == 0
assert Enum.empty?(Notification.for_user(user))
end
end
end

View file

@ -151,7 +151,7 @@ test "user is unsubscribed" 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

View file

@ -36,7 +36,7 @@ test "the home timeline", %{conn: conn} 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)

View file

@ -81,7 +81,7 @@ test "rejects incoming feed updates with the wrong signature", %{conn: conn} do
assert response(conn, 500) == "Error"
assert length(Repo.all(Activity)) == 0
assert Enum.empty?(Repo.all(Activity))
end
end
end