mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
test: add test for runtime calculation using query
This commit is contained in:
parent
aec9e1578e
commit
cd54969b03
1 changed files with 21 additions and 0 deletions
|
@ -402,4 +402,25 @@ defmodule AshPostgres.CalculationTest do
|
|||
query: Post |> Ash.Query.select([:id]) |> Ash.Query.load([:price_string_with_currency_sign])
|
||||
)
|
||||
end
|
||||
|
||||
test "runtime expression calcs" do
|
||||
author =
|
||||
Author
|
||||
|> Ash.Changeset.for_create(:create, %{
|
||||
first_name: "Bill",
|
||||
last_name: "Jones",
|
||||
bio: %{title: "Mr.", bio: "Bones"}
|
||||
})
|
||||
|> Api.create!()
|
||||
|
||||
post =
|
||||
Post
|
||||
|> Ash.Changeset.new(%{title: "match", price: 10_024})
|
||||
|> Ash.Changeset.manage_relationship(:author, author, type: :append_and_remove)
|
||||
|> Api.create!()
|
||||
|> Api.load!(:calc_returning_json)
|
||||
|
||||
author
|
||||
|> Api.load!(posts: :calc_returning_json)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue