mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 05:13:33 +12:00
test: add engine deadlock test (#78)
This commit is contained in:
parent
1f6e87ff01
commit
7f504bbf17
3 changed files with 28 additions and 5 deletions
|
@ -938,6 +938,7 @@ defmodule AshGraphql.ReadTest do
|
|||
} = result
|
||||
end
|
||||
|
||||
@tag :wip
|
||||
test "loading relationships through an unnested union with aliases works" do
|
||||
user =
|
||||
AshGraphql.Test.User
|
||||
|
@ -947,16 +948,26 @@ defmodule AshGraphql.ReadTest do
|
|||
post =
|
||||
AshGraphql.Test.Post
|
||||
|> Ash.Changeset.for_create(
|
||||
:with_comments,
|
||||
:create,
|
||||
%{
|
||||
author_id: user.id,
|
||||
text: "a",
|
||||
comments: [%{text: "comment", author_id: user.id}],
|
||||
sponsored_comments: [%{text: "sponsored"}],
|
||||
published: true
|
||||
}
|
||||
)
|
||||
|> AshGraphql.Test.Api.create!()
|
||||
|
||||
post =
|
||||
post
|
||||
|> Ash.Changeset.for_update(
|
||||
:update_with_comments,
|
||||
%{
|
||||
comments: [%{text: "comment", author_id: user.id}],
|
||||
sponsored_comments: [%{text: "sponsored"}]
|
||||
}
|
||||
)
|
||||
|> AshGraphql.Test.Api.update!()
|
||||
|
||||
resp =
|
||||
"""
|
||||
query postLibrary {
|
||||
|
@ -972,8 +983,14 @@ defmodule AshGraphql.ReadTest do
|
|||
...on SponsoredComment {
|
||||
__typename
|
||||
text
|
||||
post {
|
||||
p: post {
|
||||
id
|
||||
user: author {
|
||||
name
|
||||
posts {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1012,7 +1029,7 @@ defmodule AshGraphql.ReadTest do
|
|||
%{
|
||||
"__typename" => "SponsoredComment",
|
||||
"text" => "sponsored",
|
||||
"post" => %{"id" => ^post_id}
|
||||
"p" => %{"id" => ^post_id, "user" => %{"name" => "fred"}}
|
||||
},
|
||||
%{
|
||||
"__typename" => "Comment",
|
||||
|
|
|
@ -252,8 +252,10 @@ defmodule AshGraphql.Test.Post do
|
|||
|
||||
update :update_with_comments do
|
||||
argument(:comments, {:array, :map})
|
||||
argument(:sponsored_comments, {:array, :map})
|
||||
|
||||
change(manage_relationship(:comments, type: :direct_control))
|
||||
change(manage_relationship(:sponsored_comments, type: :direct_control))
|
||||
end
|
||||
|
||||
update :update_confirm do
|
||||
|
|
|
@ -53,6 +53,10 @@ defmodule AshGraphql.Test.User do
|
|||
attribute(:name, :string)
|
||||
end
|
||||
|
||||
relationships do
|
||||
has_many(:posts, AshGraphql.Test.Post, destination_attribute: :author_id)
|
||||
end
|
||||
|
||||
calculations do
|
||||
calculate(:name_twice, :string, expr(name <> " " <> name))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue