aboutsummaryrefslogtreecommitdiff
path: root/test/frontend_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/frontend_test.exs')
-rw-r--r--test/frontend_test.exs34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/frontend_test.exs b/test/frontend_test.exs
new file mode 100644
index 000000000..54e4524a1
--- /dev/null
+++ b/test/frontend_test.exs
@@ -0,0 +1,34 @@
+defmodule Pleroma.FrontendTest do
+ use Pleroma.DataCase
+
+ describe "get_primary_fe_opts" do
+ setup do: clear_config([:frontends])
+
+ test "normal" do
+ conf = %{primary: %{"name" => "testfe", "ref" => "test"}, static: false}
+ Pleroma.Config.put([:frontends], conf)
+
+ expected = %{
+ config: conf[:primary],
+ controller: Pleroma.Web.Frontend.TestfeController,
+ static: conf[:static]
+ }
+
+ assert Pleroma.Frontend.get_primary_fe_opts() == expected
+ assert Pleroma.Frontend.get_primary_fe_opts(conf) == expected
+ end
+
+ test "headless" do
+ conf = %{primary: %{"name" => "none"}, static: false}
+ Pleroma.Config.put([:frontends], conf)
+
+ expected = %{
+ config: %{},
+ controller: Pleroma.Web.Frontend.HeadlessController,
+ static: conf[:static]
+ }
+
+ assert Pleroma.Frontend.get_primary_fe_opts() == expected
+ end
+ end
+end