test: Add test for strict_check with filter policy (#387)

This commit is contained in:
zimt28 2022-09-27 20:43:29 +02:00 committed by GitHub
parent bc6daa56dd
commit 33a6438f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,18 @@ defmodule Ash.Test.Policy.SimpleTest do
end
end
test "filter checks work on update/destroy actions", %{user: user} do
tweet =
Tweet
|> Ash.Changeset.for_create(:create)
|> Ash.Changeset.manage_relationship(:user, user, type: :append_and_remove)
|> Api.create!()
changeset = Ash.Changeset.for_update(tweet, :update)
assert Ash.Policy.Info.strict_check(user, changeset, Api) == true
end
test "non-filter checks work on create/update/destroy actions" do
user = Api.create!(Ash.Changeset.new(User))