Delete test/plausible/customer_support/enterprise_plan_test.exs with huggingface_hub
Browse files
test/plausible/customer_support/enterprise_plan_test.exs
DELETED
|
@@ -1,158 +0,0 @@
|
|
| 1 |
-
defmodule Plausible.CustomerSupport.EnterprisePlanTest do
|
| 2 |
-
use Plausible.DataCase, async: true
|
| 3 |
-
@moduletag :ee_only
|
| 4 |
-
|
| 5 |
-
on_ee do
|
| 6 |
-
alias Plausible.CustomerSupport.EnterprisePlan
|
| 7 |
-
|
| 8 |
-
describe "estimate/8" do
|
| 9 |
-
test "calculates cost for business plan with monthly billing" do
|
| 10 |
-
result =
|
| 11 |
-
EnterprisePlan.estimate(
|
| 12 |
-
billing_interval: "monthly",
|
| 13 |
-
pageviews_per_month: 20_000_000,
|
| 14 |
-
sites_limit: 1000,
|
| 15 |
-
team_members_limit: 30,
|
| 16 |
-
api_calls_limit: 1_000,
|
| 17 |
-
features: ["sites_api"]
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
assert result == Decimal.new("1238.00")
|
| 21 |
-
end
|
| 22 |
-
|
| 23 |
-
test "calculates cost for business plan with monthly billing, SSO enabled and extra members" do
|
| 24 |
-
result =
|
| 25 |
-
EnterprisePlan.estimate(
|
| 26 |
-
billing_interval: "monthly",
|
| 27 |
-
pageviews_per_month: 20_000_000,
|
| 28 |
-
sites_limit: 1000,
|
| 29 |
-
team_members_limit: 30,
|
| 30 |
-
api_calls_limit: 1_000,
|
| 31 |
-
features: ["sites_api", "sso"]
|
| 32 |
-
)
|
| 33 |
-
|
| 34 |
-
assert result == Decimal.new("1537.00")
|
| 35 |
-
end
|
| 36 |
-
|
| 37 |
-
test "bugfix - from float" do
|
| 38 |
-
result =
|
| 39 |
-
EnterprisePlan.estimate(
|
| 40 |
-
billing_interval: "monthly",
|
| 41 |
-
pageviews_per_month: 20_000_000,
|
| 42 |
-
sites_limit: 0,
|
| 43 |
-
team_members_limit: 0,
|
| 44 |
-
api_calls_limit: 0,
|
| 45 |
-
features: ["sites_api"]
|
| 46 |
-
)
|
| 47 |
-
|
| 48 |
-
assert result == Decimal.new("738.00")
|
| 49 |
-
end
|
| 50 |
-
|
| 51 |
-
test "Bogdan's example (https://3.basecamp.com/5308029/buckets/26383192/card_tables/cards/8506177450#__recording_8689686259)" do
|
| 52 |
-
result =
|
| 53 |
-
EnterprisePlan.estimate(
|
| 54 |
-
billing_interval: "monthly",
|
| 55 |
-
pageviews_per_month: 10_000,
|
| 56 |
-
sites_limit: 500,
|
| 57 |
-
team_members_limit: 15,
|
| 58 |
-
api_calls_limit: 600,
|
| 59 |
-
features: []
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
-
assert result == Decimal.new("144.00")
|
| 63 |
-
end
|
| 64 |
-
|
| 65 |
-
test "calculates cost for business plan with yearly billing" do
|
| 66 |
-
result =
|
| 67 |
-
EnterprisePlan.estimate(
|
| 68 |
-
billing_interval: "yearly",
|
| 69 |
-
pageviews_per_month: 20_000_000,
|
| 70 |
-
sites_limit: 1000,
|
| 71 |
-
team_members_limit: 30,
|
| 72 |
-
api_calls_limit: 1_000,
|
| 73 |
-
features: ["sites_api"]
|
| 74 |
-
)
|
| 75 |
-
|
| 76 |
-
assert result == Decimal.new("12380.00")
|
| 77 |
-
end
|
| 78 |
-
|
| 79 |
-
test "Marko's managed proxy request (https://3.basecamp.com/5308029/buckets/26383192/card_tables/cards/9113635206)" do
|
| 80 |
-
result =
|
| 81 |
-
EnterprisePlan.estimate(
|
| 82 |
-
billing_interval: "monthly",
|
| 83 |
-
pageviews_per_month: 10_000,
|
| 84 |
-
sites_limit: 500,
|
| 85 |
-
team_members_limit: 15,
|
| 86 |
-
api_calls_limit: 600,
|
| 87 |
-
features: [],
|
| 88 |
-
managed_proxy_price_modifier: true
|
| 89 |
-
)
|
| 90 |
-
|
| 91 |
-
assert result == Decimal.new("343.00")
|
| 92 |
-
end
|
| 93 |
-
end
|
| 94 |
-
|
| 95 |
-
describe "pv_rate/2" do
|
| 96 |
-
test "returns correct rate for business plan" do
|
| 97 |
-
assert EnterprisePlan.pv_rate(10_000) == 19
|
| 98 |
-
assert EnterprisePlan.pv_rate(100_000) == 39
|
| 99 |
-
assert EnterprisePlan.pv_rate(200_000) == 59
|
| 100 |
-
assert EnterprisePlan.pv_rate(500_000) == 99
|
| 101 |
-
assert EnterprisePlan.pv_rate(1_000_000) == 139
|
| 102 |
-
assert EnterprisePlan.pv_rate(2_000_000) == 179
|
| 103 |
-
assert EnterprisePlan.pv_rate(5_000_000) == 259
|
| 104 |
-
assert EnterprisePlan.pv_rate(10_000_000) == 339
|
| 105 |
-
assert EnterprisePlan.pv_rate(20_000_000) == 639
|
| 106 |
-
assert EnterprisePlan.pv_rate(50_000_000) == 1379
|
| 107 |
-
assert EnterprisePlan.pv_rate(100_000_000) == 2059
|
| 108 |
-
assert EnterprisePlan.pv_rate(200_000_000) == 3259
|
| 109 |
-
assert EnterprisePlan.pv_rate(300_000_000) == 4739
|
| 110 |
-
assert EnterprisePlan.pv_rate(400_000_000) == 5979
|
| 111 |
-
assert EnterprisePlan.pv_rate(500_000_000) == 7459
|
| 112 |
-
assert EnterprisePlan.pv_rate(1_000_000_000) == 14_439
|
| 113 |
-
assert EnterprisePlan.pv_rate(1_500_000_000) == 14_439
|
| 114 |
-
end
|
| 115 |
-
end
|
| 116 |
-
|
| 117 |
-
describe "sites_rate/1" do
|
| 118 |
-
test "calculates rate based on number of sites" do
|
| 119 |
-
assert EnterprisePlan.sites_rate(10) == 0
|
| 120 |
-
assert EnterprisePlan.sites_rate(45) == 0
|
| 121 |
-
assert EnterprisePlan.sites_rate(50) == 0
|
| 122 |
-
assert EnterprisePlan.sites_rate(60) == 6.0
|
| 123 |
-
end
|
| 124 |
-
end
|
| 125 |
-
|
| 126 |
-
describe "team_members_rate/1" do
|
| 127 |
-
test "calculates rate based on number of team members" do
|
| 128 |
-
assert EnterprisePlan.team_members_rate(5) == 0
|
| 129 |
-
assert EnterprisePlan.team_members_rate(10) == 0
|
| 130 |
-
assert EnterprisePlan.team_members_rate(15) == 75
|
| 131 |
-
assert EnterprisePlan.team_members_rate(20) == 150
|
| 132 |
-
end
|
| 133 |
-
end
|
| 134 |
-
|
| 135 |
-
describe "api_calls_rate/1" do
|
| 136 |
-
test "returns correct rate for API calls" do
|
| 137 |
-
assert EnterprisePlan.api_calls_rate(500) == 0
|
| 138 |
-
assert EnterprisePlan.api_calls_rate(600) == 0
|
| 139 |
-
assert EnterprisePlan.api_calls_rate(700) == 100
|
| 140 |
-
assert EnterprisePlan.api_calls_rate(1_500) == 200
|
| 141 |
-
assert EnterprisePlan.api_calls_rate(2_000) == 200
|
| 142 |
-
assert EnterprisePlan.api_calls_rate(3_000) == 300
|
| 143 |
-
assert EnterprisePlan.api_calls_rate(3_400) == 300
|
| 144 |
-
assert EnterprisePlan.api_calls_rate(3_700) == 400
|
| 145 |
-
end
|
| 146 |
-
end
|
| 147 |
-
|
| 148 |
-
describe "features_rate/1" do
|
| 149 |
-
test "returns correct rate based on features" do
|
| 150 |
-
assert EnterprisePlan.features_rate(["sites_api"]) == 99
|
| 151 |
-
assert EnterprisePlan.features_rate(["sso"]) == 299
|
| 152 |
-
assert EnterprisePlan.features_rate(["sso", "sites_api"]) == 398
|
| 153 |
-
assert EnterprisePlan.features_rate(["funnels"]) == 0
|
| 154 |
-
assert EnterprisePlan.features_rate([]) == 0
|
| 155 |
-
end
|
| 156 |
-
end
|
| 157 |
-
end
|
| 158 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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