mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-25 09:22:22 +00:00
0c2931c10b
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Credo fix Signed-off-by: Thomas Citharel <tcit@tcit.fr> Fix rebase Signed-off-by: Thomas Citharel <tcit@tcit.fr>
37 lines
966 B
Elixir
37 lines
966 B
Elixir
defmodule MobilizonWeb.Resolvers.CommentResolverTest do
|
|
use MobilizonWeb.ConnCase
|
|
alias MobilizonWeb.AbsintheHelpers
|
|
import Mobilizon.Factory
|
|
|
|
@comment %{text: "I love this event"}
|
|
|
|
setup %{conn: conn} do
|
|
user = insert(:user)
|
|
actor = insert(:actor, user: user)
|
|
|
|
{:ok, conn: conn, actor: actor, user: user}
|
|
end
|
|
|
|
describe "Comment Resolver" do
|
|
test "create_comment/3 creates a comment", %{conn: conn, actor: actor, user: user} do
|
|
mutation = """
|
|
mutation {
|
|
createComment(
|
|
text: "#{@comment.text}",
|
|
actor_username: "#{actor.preferred_username}"
|
|
) {
|
|
text,
|
|
uuid
|
|
}
|
|
}
|
|
"""
|
|
|
|
res =
|
|
conn
|
|
|> auth_conn(user)
|
|
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
|
|
|
|
assert json_response(res, 200)["data"]["createComment"]["text"] == @comment.text
|
|
end
|
|
end
|
|
end
|