Merge branch 'remove/mastofe' into 'develop'
[akkoma] / test / pleroma / web / admin_api / controllers / frontend_controller_test.exs
index 94873f6dbc9afa4e5657eac3f04ddbdadec090eb..200682ba92d6dde618c305b04a0aa87de3219a3a 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
@@ -42,6 +42,20 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
 
       refute Enum.any?(response, fn frontend -> frontend["installed"] == true end)
     end
+
+    test "it lists available frontends when no frontend folder was created yet", %{conn: conn} do
+      File.rm_rf(@dir)
+
+      response =
+        conn
+        |> get("/api/pleroma/admin/frontends")
+        |> json_response_and_validate_schema(:ok)
+
+      assert Enum.map(response, & &1["name"]) ==
+               Enum.map(Config.get([:frontends, :available]), fn {_, map} -> map["name"] end)
+
+      refute Enum.any?(response, fn frontend -> frontend["installed"] == true end)
+    end
   end
 
   describe "POST /api/pleroma/admin/frontends/install" do