mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
test: add test for bulk creating relationships (#147)
This commit is contained in:
parent
376717ae36
commit
4704253cc2
1 changed files with 17 additions and 0 deletions
|
@ -63,6 +63,23 @@ defmodule AshPostgres.BulkCreateTest do
|
|||
nil
|
||||
end)
|
||||
end
|
||||
|
||||
test "bulk creates can create relationships" do
|
||||
Api.bulk_create!(
|
||||
[%{title: "fred", ratings: [%{score: 5}]}, %{title: "george", ratings: [%{score: 0}]}],
|
||||
Post,
|
||||
:create
|
||||
)
|
||||
|
||||
assert [
|
||||
%{title: "fred", ratings: [%{score: 5}]},
|
||||
%{title: "george", ratings: [%{score: 0}]}
|
||||
] =
|
||||
Post
|
||||
|> Ash.Query.sort(:title)
|
||||
|> Ash.Query.load(:ratings)
|
||||
|> Api.read!()
|
||||
end
|
||||
end
|
||||
|
||||
describe "validation errors" do
|
||||
|
|
Loading…
Reference in a new issue