Skip to content

Commit

Permalink
One more ForeignKeyConstraint test
Browse files Browse the repository at this point in the history
  • Loading branch information
jzimbel-mbta committed Nov 1, 2024
1 parent a1a0f02 commit 2eb6cd6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/arrow/repo/foreign_key_constraint_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ defmodule Arrow.Repo.ForeignKeyConstraintTest do
:ok
end

describe "schema" do
test "exposes all foreign key constraints" do
fkeys = Repo.all(from fk in ForeignKeyConstraint, select: fk.name)
assert length(fkeys) >= 4

assert MapSet.subset?(
MapSet.new(~w[a_b_id_fkey a_c_id_fkey b_c_id_fkey c_a_id_fkey]),
MapSet.new(fkeys)
)
end
end

describe "external_constraints_referencing_tables/1" do
test "returns fkeys referencing one of the given tables from an external table" do
assert fkeys = ForeignKeyConstraint.external_constraints_referencing_tables(["b", "c"])
Expand Down

0 comments on commit 2eb6cd6

Please sign in to comment.