Skip to content

Commit b543b7d

Browse files
committed
test: add tests for Ash.calculate with non-field calculations
1 parent 94029e2 commit b543b7d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/calculation_test.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,5 +1783,14 @@ defmodule AshPostgres.CalculationTest do
17831783
test "do not add a key to the resource struct" do
17841784
refute Map.has_key?(%Author{}, :non_field_full_name)
17851785
end
1786+
1787+
test "works with Ash.calculate" do
1788+
author =
1789+
Author
1790+
|> Ash.Changeset.for_create(:create, %{first_name: "zach", last_name: "daniel"})
1791+
|> Ash.create!()
1792+
1793+
assert {:ok, "zach daniel"} = Ash.calculate(author, :non_field_full_name)
1794+
end
17861795
end
17871796
end

0 commit comments

Comments
 (0)