mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
19 lines
518 B
Elixir
19 lines
518 B
Elixir
defmodule AshPostgres.SubqueryTest do
|
|
use AshPostgres.RepoCase, async: false
|
|
|
|
alias AshPostgres.Test.Subquery.{Access, Child, Parent, Through}
|
|
|
|
test "joins are correctly wrapped in subqueries" do
|
|
{:ok, child} = Child.create(%{})
|
|
|
|
{:ok, parent} =
|
|
Parent.create(%{visible: true})
|
|
|
|
Access.create(%{parent_id: parent.id, email: "foo@bar.com"})
|
|
|
|
Through.create(%{parent_id: parent.id, child_id: child.id})
|
|
|
|
assert {:ok, _} =
|
|
Child.read(actor: %{email: "foo@bar.com"})
|
|
end
|
|
end
|