Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Fix tests
Uku Tahtebdd856df7f3
diff --git a/lib/plausible_web/controllers/billing_controller.ex b/lib/plausible_web/controllers/billing_controller.exindex 012a327e17..9c9cd1e91d 100644--- a/lib/plausible_web/controllers/billing_controller.ex+++ b/lib/plausible_web/controllers/billing_controller.ex@@ -80,21 +80,12 @@ defmodule PlausibleWeb.BillingController dodef change_enterprise_plan(conn, %{"plan_id" => plan_id}) douser = conn.assigns[:current_user]- current_plan =- Repo.get_by(Plausible.Billing.EnterprisePlan,- user_id: user.id,- paddle_plan_id: user.subscription.paddle_plan_id- )-new_plan = Repo.get_by(Plausible.Billing.EnterprisePlan, user_id: user.id, id: plan_id)cond dois_nil(user.subscription) ->redirect(conn, to: "/billing/upgrade")- is_nil(current_plan) ->- render_error(conn, 404)-is_nil(new_plan) || new_plan.paddle_plan_id == user.subscription.paddle_plan_id ->render_error(conn, 404)@@ -109,7 +100,6 @@ defmodule PlausibleWeb.BillingController dodef change_plan_preview(conn, %{"plan_id" => new_plan_id}) dosubscription = Billing.active_subscription_for(conn.assigns[:current_user].id)- IO.inspect(subscription)if subscription do{:ok, preview_info} = Billing.change_plan_preview(subscription, new_plan_id)diff --git a/test/plausible_web/controllers/billing_controller_test.exs b/test/plausible_web/controllers/billing_controller_test.exsindex 43b60effe6..072277dc2d 100644--- a/test/plausible_web/controllers/billing_controller_test.exs+++ b/test/plausible_web/controllers/billing_controller_test.exs@@ -58,13 +58,13 @@ defmodule PlausibleWeb.BillingControllerTest doassert redirected_to(conn) == "/billing/upgrade"end- test "redirects to enterprise change plan page if user has enterprise plan and existing subscription",+ test "prompts to contact us if user has enterprise plan and existing subscription",%{conn: conn, user: user} doinsert(:subscription, user: user)- plan = insert(:enterprise_plan, user: user)+ insert(:enterprise_plan, user: user)conn = get(conn, "/billing/change-plan")- assert redirected_to(conn) == "/billing/change-plan/enterprise/#{plan.id}"+ assert html_response(conn, 200) =~ "please contact us"endend