Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule MyApp.AbsintheSchemaTest do
- use MyApp.ConnCase
- import MyApp.Factories
- @query """
- query($id: ID) {
- user(id: $id) {
- name
- email
- post {
- content
- }
- }
- """
- test "post field returns post content when the user has access to it" do
- user = insert(:user)
- post = insert(:post, user: user)
- conn = build_conn()
- conn = get(conn, "/gql", query: @query, variables: %{"id" => post.id})
- assert json_response(conn, 200) == %{
- "data" => %{
- "user" => %{
- "name" => user.name,
- "email" => user.email,
- "post" => %{
- "content" => post.content
- }
- }
- }
- }
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement