Skip to content

Commit 960d4f4

Browse files
authored
fix: correct test expectation for first aggregate with include_nil? (#683)
The test was asserting buggy behavior. With `sort(title: :asc_nils_first)` and `include_nil?: true`, the `first` aggregate should return `nil` when the first sorted record has a nil value, not skip to the next non-nil value.
1 parent ebde288 commit 960d4f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/aggregate_test.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,9 @@ defmodule AshSql.AggregateTest do
874874
|> Ash.Changeset.manage_relationship(:post, post, type: :append_and_remove)
875875
|> Ash.create!()
876876

877-
assert "match" ==
877+
# With sort(title: :asc_nils_first), nil comes first.
878+
# With include_nil?: true, we should get nil (not skip to the next non-nil value)
879+
assert nil ==
878880
Post
879881
|> Ash.Query.filter(id == ^post.id)
880882
|> Ash.Query.load(:first_comment_nils_first_include_nil)

0 commit comments

Comments
 (0)