test: add test for bugfix in ash

This commit is contained in:
Zach Daniel 2024-08-30 18:13:15 -04:00
parent c104e6a2ba
commit 06c0c328df

View file

@ -106,6 +106,8 @@ defmodule AshPostgres.BulkUpdateTest do
test "bulk updates honor update action filters when streaming" do
Ash.bulk_create!([%{title: "fred"}, %{title: "george"}], Post, :create)
Logger.configure(level: :debug)
Post
|> Ash.bulk_update!(:update_only_freds, %{},
strategy: :stream,
@ -113,9 +115,18 @@ defmodule AshPostgres.BulkUpdateTest do
atomic_update: %{title: Ash.Expr.expr(title <> "_stuff")}
)
titles =
posts =
Post
|> Ash.read!()
fred =
posts
|> Enum.find(&(&1.title == "fred_stuff"))
assert fred.created_at != fred.updated_at
titles =
posts
|> Enum.map(& &1.title)
|> Enum.sort()