Skip to content

Commit f33cfbe

Browse files
authored
test: Demonstrate failed query for is_nil on array within jsonb (#615)
1 parent b2f98cf commit f33cfbe

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

test/storage_types_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ defmodule AshPostgres.StorageTypesTest do
6666
|> Ash.read!()
6767
end
6868

69+
@tag capture_log: false
6970
test "`is_nil` operator works on get_path results" do
7071
%{id: id} =
7172
Author
@@ -85,7 +86,7 @@ defmodule AshPostgres.StorageTypesTest do
8586

8687
assert [%Author{id: ^id}] =
8788
Author
88-
|> Ash.Query.filter(is_nil(settings["optional_field"]))
89+
|> Ash.Query.filter(is_nil(settings["dues_reminders"]))
8990
|> Ash.read!()
9091
end
9192
end

test/support/resources/author.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ defmodule AshPostgres.Test.Author do
3030
attribute(:bio, AshPostgres.Test.Bio, public?: true)
3131
attribute(:bios, {:array, :map}, public?: true)
3232
attribute(:badges, {:array, :atom}, public?: true)
33-
attribute(:settings, :map, public?: true)
33+
attribute(:settings, AshPostgres.Test.Settings, public?: true)
3434
end
3535

3636
actions do

test/support/resources/settings.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
defmodule AshPostgres.Test.Settings do
2+
@moduledoc false
3+
use Ash.Resource, data_layer: :embedded
4+
5+
attributes do
6+
attribute :dues_reminders, {:array, :string}, public?: true
7+
attribute :newsletter, {:array, :string}, public?: true
8+
attribute :optional_field, :string, public?: true
9+
end
10+
end

0 commit comments

Comments
 (0)