fix: deprecation warnings in tests.

This commit is contained in:
James Harton 2024-04-02 10:40:06 +13:00
parent b370512b62
commit 6355e8da54
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -124,7 +124,7 @@ defmodule AshCubDB.DataLayerTest do
[actual] = [actual] =
Author Author
|> Query.filter(name: "Marty McFly") |> Query.filter(name: "Marty McFly")
|> Domain.read!() |> Ash.read!()
assert expected.id == actual.id assert expected.id == actual.id
end end
@ -137,7 +137,7 @@ defmodule AshCubDB.DataLayerTest do
sorted = sorted =
Author Author
|> Query.sort(name: :desc) |> Query.sort(name: :desc)
|> Domain.read!() |> Ash.read!()
assert Enum.map(sorted, &to_string(&1.name)) == ["Mallory", "Bob", "Alice"] assert Enum.map(sorted, &to_string(&1.name)) == ["Mallory", "Bob", "Alice"]
end end
@ -148,7 +148,7 @@ defmodule AshCubDB.DataLayerTest do
assert [_] = assert [_] =
Author Author
|> Query.limit(1) |> Query.limit(1)
|> Domain.read!() |> Ash.read!()
end end
test "offset" do test "offset" do
@ -157,7 +157,7 @@ defmodule AshCubDB.DataLayerTest do
assert [_, _] = assert [_, _] =
Author Author
|> Query.offset(1) |> Query.offset(1)
|> Domain.read!() |> Ash.read!()
end end
test "distinct" do test "distinct" do
@ -167,7 +167,7 @@ defmodule AshCubDB.DataLayerTest do
assert [selected] = assert [selected] =
Author Author
|> Query.distinct(:name) |> Query.distinct(:name)
|> Domain.read!() |> Ash.read!()
assert selected.name == author.name assert selected.name == author.name
end end
@ -181,7 +181,7 @@ defmodule AshCubDB.DataLayerTest do
Post Post
|> Query.distinct(:title) |> Query.distinct(:title)
|> Query.distinct_sort(body: :desc) |> Query.distinct_sort(body: :desc)
|> Domain.read!() |> Ash.read!()
assert selected.title == post.title assert selected.title == post.title
assert selected.body == "Mallory is cool" assert selected.body == "Mallory is cool"