aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/frontends/admin/README.md1
-rw-r--r--test/fixtures/frontends/admin/dist/index.html2
-rw-r--r--test/fixtures/frontends/admin/package.json1
-rw-r--r--test/fixtures/frontends/kenoma/README.md1
-rw-r--r--test/fixtures/frontends/kenoma/build/index.html2
-rw-r--r--test/fixtures/frontends/kenoma/package.json1
-rw-r--r--test/fixtures/frontends/mastodon/README.md1
-rw-r--r--test/fixtures/frontends/mastodon/package.json1
-rw-r--r--test/fixtures/frontends/mastodon/public/assets/sw.js0
-rw-r--r--test/fixtures/frontends/mastodon/public/packs/locales.js0
-rw-r--r--test/fixtures/frontends/mastodon/public/unused_dir/unused_file20
-rw-r--r--test/fixtures/frontends/mastodon/public/unused_file0
-rw-r--r--test/fixtures/frontends/pleroma/README.md1
-rw-r--r--test/fixtures/frontends/pleroma/dist/index.html2
-rw-r--r--test/fixtures/frontends/pleroma/package.json1
-rw-r--r--test/tasks/frontend_test.exs36
16 files changed, 35 insertions, 15 deletions
diff --git a/test/fixtures/frontends/admin/README.md b/test/fixtures/frontends/admin/README.md
new file mode 100644
index 000000000..6953c067e
--- /dev/null
+++ b/test/fixtures/frontends/admin/README.md
@@ -0,0 +1 @@
+# Fixture for Admin frontend \ No newline at end of file
diff --git a/test/fixtures/frontends/admin/dist/index.html b/test/fixtures/frontends/admin/dist/index.html
new file mode 100644
index 000000000..00ccd713a
--- /dev/null
+++ b/test/fixtures/frontends/admin/dist/index.html
@@ -0,0 +1,2 @@
+<h1>test Admin FE</h1>
+<!--server-generated-meta--> \ No newline at end of file
diff --git a/test/fixtures/frontends/admin/package.json b/test/fixtures/frontends/admin/package.json
new file mode 100644
index 000000000..eef793abd
--- /dev/null
+++ b/test/fixtures/frontends/admin/package.json
@@ -0,0 +1 @@
+{"version": "42"}
diff --git a/test/fixtures/frontends/kenoma/README.md b/test/fixtures/frontends/kenoma/README.md
new file mode 100644
index 000000000..5043a37cf
--- /dev/null
+++ b/test/fixtures/frontends/kenoma/README.md
@@ -0,0 +1 @@
+# Fixture for Kenoma frontend \ No newline at end of file
diff --git a/test/fixtures/frontends/kenoma/build/index.html b/test/fixtures/frontends/kenoma/build/index.html
new file mode 100644
index 000000000..313c1e274
--- /dev/null
+++ b/test/fixtures/frontends/kenoma/build/index.html
@@ -0,0 +1,2 @@
+<h1>test Kenoma FE</h1>
+<!--server-generated-meta--> \ No newline at end of file
diff --git a/test/fixtures/frontends/kenoma/package.json b/test/fixtures/frontends/kenoma/package.json
new file mode 100644
index 000000000..eef793abd
--- /dev/null
+++ b/test/fixtures/frontends/kenoma/package.json
@@ -0,0 +1 @@
+{"version": "42"}
diff --git a/test/fixtures/frontends/mastodon/README.md b/test/fixtures/frontends/mastodon/README.md
new file mode 100644
index 000000000..f5ec3e2d4
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/README.md
@@ -0,0 +1 @@
+# Fixture for Mastodon frontend \ No newline at end of file
diff --git a/test/fixtures/frontends/mastodon/package.json b/test/fixtures/frontends/mastodon/package.json
new file mode 100644
index 000000000..9e26dfeeb
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/package.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/test/fixtures/frontends/mastodon/public/assets/sw.js b/test/fixtures/frontends/mastodon/public/assets/sw.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/public/assets/sw.js
diff --git a/test/fixtures/frontends/mastodon/public/packs/locales.js b/test/fixtures/frontends/mastodon/public/packs/locales.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/public/packs/locales.js
diff --git a/test/fixtures/frontends/mastodon/public/unused_dir/unused_file2 b/test/fixtures/frontends/mastodon/public/unused_dir/unused_file2
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/public/unused_dir/unused_file2
diff --git a/test/fixtures/frontends/mastodon/public/unused_file b/test/fixtures/frontends/mastodon/public/unused_file
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fixtures/frontends/mastodon/public/unused_file
diff --git a/test/fixtures/frontends/pleroma/README.md b/test/fixtures/frontends/pleroma/README.md
new file mode 100644
index 000000000..63b74bedd
--- /dev/null
+++ b/test/fixtures/frontends/pleroma/README.md
@@ -0,0 +1 @@
+# Fixture for Pleroma frontend \ No newline at end of file
diff --git a/test/fixtures/frontends/pleroma/dist/index.html b/test/fixtures/frontends/pleroma/dist/index.html
new file mode 100644
index 000000000..38400b1ee
--- /dev/null
+++ b/test/fixtures/frontends/pleroma/dist/index.html
@@ -0,0 +1,2 @@
+<h1>test Pleroma FE</h1>
+<!--server-generated-meta--> \ No newline at end of file
diff --git a/test/fixtures/frontends/pleroma/package.json b/test/fixtures/frontends/pleroma/package.json
new file mode 100644
index 000000000..eef793abd
--- /dev/null
+++ b/test/fixtures/frontends/pleroma/package.json
@@ -0,0 +1 @@
+{"version": "42"}
diff --git a/test/tasks/frontend_test.exs b/test/tasks/frontend_test.exs
index 2f9458f89..fcd07150f 100644
--- a/test/tasks/frontend_test.exs
+++ b/test/tasks/frontend_test.exs
@@ -10,7 +10,8 @@ defmodule Mix.Tasks.Pleroma.FrontendTest do
@bundle_zip_path Path.absname("test/fixtures/tesla_mock/fe-bundle.zip")
- @dir "test/tmp/instance_static"
+ @tmp "test/tmp"
+ @dir "#{@tmp}/instance_static"
setup_all do
Mix.shell(Mix.Shell.Process)
@@ -47,21 +48,26 @@ defmodule Mix.Tasks.Pleroma.FrontendTest do
:ok
end
- test "installations" do
- frontends = ~w(pleroma kenoma mastodon admin)
- refs = ~w(develop stable 1.2.3)
+ describe "Installations from local path" do
+ test "Frontends with standard dist structure" do
+ ~w(pleroma kenoma admin)
+ |> Enum.each(fn frontend ->
+ path = "test/fixtures/frontends/#{frontend}"
+ Mix.Tasks.Pleroma.Frontend.run(~w(install #{frontend} --path #{path}))
- Enum.each(frontends, fn frontend ->
- Enum.each(refs, fn ref ->
- Mix.Tasks.Pleroma.Frontend.run([
- "install",
- frontend,
- "--ref",
- ref
- ])
-
- assert File.exists?(Path.join([@dir, "frontends/#{frontend}/#{ref}/index.html"]))
+ assert File.exists?("#{@dir}/frontends/#{frontend}/42/index.html")
+ refute File.exists?("#{@dir}/frontends/#{frontend}/42/package.json")
end)
- end)
+ end
+
+ test "Mastodon" do
+ path = "test/fixtures/frontends/mastodon"
+ Mix.Tasks.Pleroma.Frontend.run(~w(install mastodon --path #{path}))
+
+ assert File.exists?("#{@dir}/frontends/mastodon/__local__/sw.js")
+ assert File.exists?("#{@dir}/frontends/mastodon/__local__/packs/locales.js")
+ refute File.exists?("#{@dir}/frontends/mastodon/__local__/unused_file")
+ refute File.exists?("#{@dir}/frontends/mastodon/__local__/unused_dir")
+ end
end
end