ash/test/query/operator/eq_test.exs
Andreas Donig 4153ba7ef3
fix: fix the compare/2 implementations (#1232)
Co-authored-by: Andreas Donig <git@innwiese.de>
2024-06-10 08:15:51 -04:00

29 lines
800 B
Elixir

defmodule Ash.Query.Operator.EqTest do
use ExUnit.Case
alias Ash.Query.Operator.Eq
alias Ash.Query.Operator.In
describe "compare/2" do
test "returns :mutually_inclusive for equal left and right values" do
left = %Eq{left: 1, right: 2}
right = %Eq{left: 1, right: 2}
assert Eq.compare(left, right) == :mutually_inclusive
end
test "returns :mutually_exclusive for different right values" do
left = %Eq{left: 1, right: 2}
right = %Eq{left: 1, right: 3}
assert Eq.compare(left, right) == :mutually_exclusive
end
test "returns :right_includes_left for Eq in In" do
left = %Eq{left: 1, right: 2}
right = %In{left: 1, right: MapSet.new([2, 3])}
assert Eq.compare(left, right) == :right_includes_left
end
end
end