From 7ca7dc695e19cec6e4f87262ae5d78d700f3553e Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Fri, 10 Mar 2023 12:15:43 -0300 Subject: [PATCH] Rename comparison tests --- test/plausible/stats/comparisons_test.exs | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/plausible/stats/comparisons_test.exs b/test/plausible/stats/comparisons_test.exs index e4e28e9b3..043adbad5 100644 --- a/test/plausible/stats/comparisons_test.exs +++ b/test/plausible/stats/comparisons_test.exs @@ -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"})