forked from AkkomaGang/akkoma
Fix some test stuff.
This commit is contained in:
parent
4e4a3e5e13
commit
1b57522bba
2 changed files with 14 additions and 10 deletions
|
@ -51,8 +51,9 @@ def init(ref, socket, transport, _Opts = []) do
|
||||||
|
|
||||||
def info(text) do
|
def info(text) do
|
||||||
text = String.replace(text, ~r/[\t\n]/, "")
|
text = String.replace(text, ~r/[\t\n]/, "")
|
||||||
|
|
||||||
String.split(text, "\r")
|
String.split(text, "\r")
|
||||||
|> Enum.map(fn (text) ->
|
|> Enum.map(fn text ->
|
||||||
"i#{text}\tfake\(NULL)\t0\r\n"
|
"i#{text}\tfake\(NULL)\t0\r\n"
|
||||||
end)
|
end)
|
||||||
|> Enum.join("")
|
|> Enum.join("")
|
||||||
|
@ -82,7 +83,12 @@ def render_activities(activities) do
|
||||||
|
|
||||||
link("Post ##{activity.id} by #{user.nickname}", "/notices/#{activity.id}") <>
|
link("Post ##{activity.id} by #{user.nickname}", "/notices/#{activity.id}") <>
|
||||||
info("#{like_count} likes, #{announcement_count} repeats") <>
|
info("#{like_count} likes, #{announcement_count} repeats") <>
|
||||||
"\r\n" <> info(HtmlSanitizeEx.strip_tags(String.replace(activity.data["object"]["content"], "<br>", "\r")))
|
"\r\n" <>
|
||||||
|
info(
|
||||||
|
HtmlSanitizeEx.strip_tags(
|
||||||
|
String.replace(activity.data["object"]["content"], "<br>", "\r")
|
||||||
|
)
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|> Enum.join("\r\n")
|
|> Enum.join("\r\n")
|
||||||
end
|
end
|
||||||
|
|
|
@ -600,8 +600,9 @@ test "it returns a user's followers", %{conn: conn} do
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/statuses/followers")
|
|> get("/api/statuses/followers")
|
||||||
|
|
||||||
assert json_response(conn, 200) ==
|
expected = UserView.render("index.json", %{users: [follower_one, follower_two], for: user})
|
||||||
UserView.render("index.json", %{users: [follower_one, follower_two], for: user})
|
result = json_response(conn, 200)
|
||||||
|
assert Enum.sort(expected) == Enum.sort(result)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -620,12 +621,9 @@ test "it returns the logged in user's friends", %{conn: conn} do
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/statuses/friends")
|
|> get("/api/statuses/friends")
|
||||||
|
|
||||||
assert MapSet.equal?(
|
expected = UserView.render("index.json", %{users: [followed_one, followed_two], for: user})
|
||||||
MapSet.new(json_response(conn, 200)),
|
result = json_response(conn, 200)
|
||||||
MapSet.new(
|
assert Enum.sort(expected) == Enum.sort(result)
|
||||||
UserView.render("index.json", %{users: [followed_one, followed_two], for: user})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns a given user's friends with user_id", %{conn: conn} do
|
test "it returns a given user's friends with user_id", %{conn: conn} do
|
||||||
|
|
Loading…
Reference in a new issue