mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 03:04:43 +03:00
Fix tests
This commit is contained in:
parent
9a77644517
commit
0b253421ce
@ -3,7 +3,7 @@ Hey <%= user_salutation(@user) %>,
|
||||
Thanks for exploring Plausible, a simple and privacy-friendly alternative to Google Analytics. Your free 30-day trial is ending <%= @day %>, but you can keep using Plausible by upgrading to a paid plan.
|
||||
<br /><br />
|
||||
In the last month, your account has used <%= PlausibleWeb.AuthView.delimit_integer(@usage) %> billable pageviews<%= if @custom_events > 0, do: " and custom events in total", else: "" %>.
|
||||
<%= if @usage <= 20_000_000 do %>
|
||||
<%= if @usage <= 10_000_000 do %>
|
||||
Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan.
|
||||
<br /><br />
|
||||
<%= link("Upgrade now", to: "#{plausible_url()}/billing/upgrade") %>
|
||||
|
@ -4,6 +4,7 @@ defmodule Plausible.Billing.PlansTest do
|
||||
|
||||
@v1_plan_id "558018"
|
||||
@v2_plan_id "654177"
|
||||
@v3_plan_id "749342"
|
||||
|
||||
describe "plans_for" do
|
||||
test "shows v1 pricing for users who are already on v1 pricing" do
|
||||
@ -12,11 +13,23 @@ defmodule Plausible.Billing.PlansTest do
|
||||
assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v1_plan_id
|
||||
end
|
||||
|
||||
test "shows v2 pricing for everyone else" do
|
||||
user = insert(:user) |> Repo.preload(:subscription)
|
||||
test "shows v2 pricing for users who are already on v2 pricing" do
|
||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v2_plan_id))
|
||||
|
||||
assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v2_plan_id
|
||||
end
|
||||
|
||||
test "shows v2 pricing for users who signed up in 2021" do
|
||||
user = insert(:user, inserted_at: ~N[2021-12-31 00:00:00]) |> Repo.preload(:subscription)
|
||||
|
||||
assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v2_plan_id
|
||||
end
|
||||
|
||||
test "shows v3 pricing for everyone else" do
|
||||
user = insert(:user) |> Repo.preload(:subscription)
|
||||
|
||||
assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v3_plan_id
|
||||
end
|
||||
end
|
||||
|
||||
describe "allowance" do
|
||||
|
@ -162,17 +162,10 @@ defmodule Plausible.Workers.SendTrialNotificationsTest do
|
||||
assert email.html_body =~ "we recommend you select the 10M/mo plan."
|
||||
end
|
||||
|
||||
test "suggests 20m/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {19_000_000, 0})
|
||||
assert email.html_body =~ "we recommend you select the 20M/mo plan."
|
||||
end
|
||||
|
||||
test "does not suggest a plan above that" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {50_000_000, 0})
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {20_000_000, 0})
|
||||
assert email.html_body =~ "please reply back to this email to get a quote for your volume"
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user