From 9439d04fa74c44b761b044c81f45ecbbc3a25727 Mon Sep 17 00:00:00 2001 From: Chris Bailey Date: Wed, 17 Jan 2024 12:00:10 +0000 Subject: [PATCH] END-013 - Test for `Endo.table_schema/0` --- test/endo_test.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/endo_test.exs b/test/endo_test.exs index b7e4546..f57a385 100644 --- a/test/endo_test.exs +++ b/test/endo_test.exs @@ -6,6 +6,19 @@ defmodule EndoTest do {:ok, find: fn tables, name -> Enum.find(tables, &(&1.name == name)) end} end + describe "table_schema/0" do + test "returns specified table schema" do + # If configured, return the configured value + assert :ok = Application.put_env(:endo, :table_schema, "a_custom_schema_prefix") + assert "a_custom_schema_prefix" = Endo.table_schema() + + # TODO: Otherwise fall back to "public" which is the default in Postgres at least -- + # might need to investigate how we go about supporting this for future adapters. + assert :ok = Application.delete_env(:endo, :table_schema) + assert "public" = Endo.table_schema() + end + end + describe "list_tables/2" do test "returns error when given non-ecto repo" do assert_raise(