mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-19 13:03:14 +12:00
test: add new test verifying batch destroy behavior
chore: add sobelow warning skip
This commit is contained in:
parent
d71cb81792
commit
b018262637
3 changed files with 13 additions and 3 deletions
|
@ -72,13 +72,13 @@ defmodule AshPostgres.CustomIndex do
|
|||
|
||||
def schema, do: @schema
|
||||
|
||||
# sobelow_skip ["DOS.StringToAtom"]
|
||||
def transform(index) do
|
||||
with {:ok, index} <- set_name(index) do
|
||||
set_error_fields(index)
|
||||
end
|
||||
end
|
||||
|
||||
# sobelow_skip ["DOS.StringToAtom"]
|
||||
defp set_error_fields(index) do
|
||||
if index.error_fields do
|
||||
{:ok, index}
|
||||
|
|
2
mix.exs
2
mix.exs
|
@ -158,7 +158,7 @@ defmodule AshPostgres.MixProject do
|
|||
{:jason, "~> 1.0"},
|
||||
{:postgrex, ">= 0.0.0"},
|
||||
{:ash,
|
||||
ash_version(github: "ash-project/ash", ref: "3b3e3a06f26a1cb43d69e1e470a462c37fb84987")},
|
||||
ash_version(github: "ash-project/ash", ref: "57654d3df49d39fe727bd86df3a0496c8598c7c1")},
|
||||
{:benchee, "~> 1.1", only: [:dev, :test]},
|
||||
{:git_ops, "~> 2.5", only: [:dev, :test]},
|
||||
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},
|
||||
|
|
|
@ -17,7 +17,7 @@ defmodule AshPostgres.BulkDestroyTest do
|
|||
assert Api.read!(Post) == []
|
||||
end
|
||||
|
||||
test "bulk updates only apply to things that the query produces" do
|
||||
test "bulk destroys only apply to things that the query produces" do
|
||||
Api.bulk_create!([%{title: "fred"}, %{title: "george"}], Post, :create)
|
||||
|
||||
Post
|
||||
|
@ -27,4 +27,14 @@ defmodule AshPostgres.BulkDestroyTest do
|
|||
# 😢 sad
|
||||
assert [%{title: "george"}] = Api.read!(Post)
|
||||
end
|
||||
|
||||
test "bulk destroys can be done even on stream inputs" do
|
||||
Api.bulk_create!([%{title: "fred"}, %{title: "george"}], Post, :create)
|
||||
|
||||
Post
|
||||
|> Api.read!()
|
||||
|> Api.bulk_destroy!(:destroy, %{})
|
||||
|
||||
assert [] = Api.read!(Post)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue