analytics/test/plausible/release_test.exs
ruslandoga 0b7870dc4d
improve first launch experience for self-hosters (#2357)
* first launch

* dynamic children, wait for repo

* remove wait_for_repo and app env manipulations

* don't mention free trial in self-hosted pages

* add changelog

* assigns[:is_selfhost] -> @is_selfhost

* better changelog wording

* rm admin_user, admin_email, admin_pwd from app env

* rm DISABLE_AUTH

* redirect / to /login when not authenticated

* remove TODO

* Update lib/plausible_web/controllers/page_controller.ex

Co-authored-by: Uku Taht <Uku.taht@gmail.com>

* format

Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2022-11-10 12:42:22 +01:00

31 lines
875 B
Elixir

defmodule Plausible.ReleaseTest do
use Plausible.DataCase
alias Plausible.{Release, Auth}
describe "should_be_first_launch?/0" do
test "returns true when self-hosted and no users" do
patch_env(:is_selfhost, true)
refute Repo.exists?(Auth.User)
assert Release.should_be_first_launch?()
end
test "returns false when not self-hosted and has no users" do
patch_env(:is_selfhost, false)
refute Repo.exists?(Auth.User)
refute Release.should_be_first_launch?()
end
test "returns false when not self-hosted and has users" do
insert(:user)
patch_env(:is_selfhost, false)
refute Release.should_be_first_launch?()
end
test "returns false when self-hosted and has users" do
insert(:user)
patch_env(:is_selfhost, true)
refute Release.should_be_first_launch?()
end
end
end