Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lcmen committed Feb 10, 2025
1 parent 641dffc commit 20e2703
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/resource/identities_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ defmodule Ash.Test.Resource.IdentitiesTest do
] = Ash.Resource.Info.identities(Post)
end

test "Identity field names are allowed" do
defposts do
actions do
default_accept :*

read :read do
primary? true
end
end

identities do
identity :foobar, [:name, :contents], field_names: [:contents]
end
end

assert [
%Ash.Resource.Identity{field_names: [:contents]}
] = Ash.Resource.Info.identities(Post)
end

test "enforce identity domain is inferred" do
assert_raise Spark.Error.DslError,
~r/Cannot infer eager_check_with, because the domain is not specified on this resource./,
Expand Down

0 comments on commit 20e2703

Please sign in to comment.