Rename comparison tests

custom-comparison-mode-end-date-spike
Vinicius Brasil 4 years ago
parent 49e4c2fb64
commit 7ca7dc695e

@ -2,8 +2,8 @@ defmodule Plausible.Stats.ComparisonsTest do
use Plausible.DataCase
alias Plausible.Stats.{Query, Comparisons}
describe "this month" do
test "shifts back this month period" do
describe "with period set to this month" do
test "shifts back this month period when mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "month", "date" => "2023-03-02"})
now = ~N[2023-03-02 14:00:00]
@ -14,7 +14,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2023-02-28]
end
test "shifts back this month period when it's the first day of the month" do
test "shifts back this month period when it's the first day of the month and mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "month", "date" => "2023-03-01"})
now = ~N[2023-03-01 14:00:00]
@ -26,8 +26,8 @@ defmodule Plausible.Stats.ComparisonsTest do
end
end
describe "previous month" do
test "shifts back using the same number of days when previous_period" do
describe "with period set to previous month" do
test "shifts back using the same number of days when mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "month", "date" => "2023-02-01"})
now = ~N[2023-03-01 14:00:00]
@ -38,7 +38,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2023-01-31]
end
test "shifts back the full month when year_over_year" do
test "shifts back the full month when mode is year_over_year" do
site = build(:site)
query = Query.from(site, %{"period" => "month", "date" => "2023-02-01"})
now = ~N[2023-03-01 14:00:00]
@ -49,7 +49,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2022-02-28]
end
test "shifts back whole month plus one day when year_over_year and a leap year" do
test "shifts back whole month plus one day when mode is year_over_year and a leap year" do
site = build(:site)
query = Query.from(site, %{"period" => "month", "date" => "2020-02-01"})
now = ~N[2023-03-01 14:00:00]
@ -61,8 +61,8 @@ defmodule Plausible.Stats.ComparisonsTest do
end
end
describe "year to date" do
test "shifts back by the same number of days when previous_period" do
describe "with period set to year to date" do
test "shifts back by the same number of days when mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "year", "date" => "2023-03-01"})
now = ~N[2023-03-01 14:00:00]
@ -73,7 +73,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2022-12-31]
end
test "shifts back by the same number of days when year_over_year" do
test "shifts back by the same number of days when mode is year_over_year" do
site = build(:site)
query = Query.from(site, %{"period" => "year", "date" => "2023-03-01"})
now = ~N[2023-03-01 14:00:00]
@ -85,8 +85,8 @@ defmodule Plausible.Stats.ComparisonsTest do
end
end
describe "previous year" do
test "shifts back a whole year when year_over_year" do
describe "with period set to previous year" do
test "shifts back a whole year when mode is year_over_year" do
site = build(:site)
query = Query.from(site, %{"period" => "year", "date" => "2022-03-02"})
@ -96,7 +96,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2021-12-31]
end
test "shifts back a whole year when previous_period" do
test "shifts back a whole year when mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "year", "date" => "2022-03-02"})
@ -107,8 +107,8 @@ defmodule Plausible.Stats.ComparisonsTest do
end
end
describe "custom" do
test "shifts back by the same number of days when previous_period" do
describe "with period set to custom" do
test "shifts back by the same number of days when mode is previous_period" do
site = build(:site)
query = Query.from(site, %{"period" => "custom", "date" => "2023-01-01,2023-01-07"})
@ -118,7 +118,7 @@ defmodule Plausible.Stats.ComparisonsTest do
assert comparison.date_range.last == ~D[2022-12-31]
end
test "shifts back to last year when year_over_year" do
test "shifts back to last year when mode is year_over_year" do
site = build(:site)
query = Query.from(site, %{"period" => "custom", "date" => "2023-01-01,2023-01-07"})

Loading…
Cancel
Save