mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
7f8aa98f24
fix: un-break the `in` filter type casting code test: add tests for untested features
21 lines
580 B
Elixir
21 lines
580 B
Elixir
defmodule AshPostgres.Test.UniqueIdentityTest do
|
|
use AshPostgres.RepoCase, async: false
|
|
alias AshPostgres.Test.{Api, Post}
|
|
|
|
require Ash.Query
|
|
|
|
test "unique constraint errors are properly caught" do
|
|
post =
|
|
Post
|
|
|> Ash.Changeset.new(%{title: "title"})
|
|
|> Api.create!()
|
|
|
|
assert_raise Ash.Error.Invalid,
|
|
~r/Invalid value provided for id: has already been taken/,
|
|
fn ->
|
|
Post
|
|
|> Ash.Changeset.new(%{id: post.id})
|
|
|> Api.create!()
|
|
end
|
|
end
|
|
end
|