Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Fix tests

Uku Taht25baa6bae978
diff --git a/test/plausible/stats/query_test.exs b/test/plausible/stats/query_test.exs
index b093fcfb17..1272c119d4 100644
--- a/test/plausible/stats/query_test.exs
+++ b/test/plausible/stats/query_test.exs
@@ -5,7 +5,8 @@ defmodule Plausible.Stats.QueryTest do
@site_inserted_at ~D[2020-01-01]
@site %Plausible.Site{
timezone: "UTC",
- inserted_at: @site_inserted_at
+ inserted_at: @site_inserted_at,
+ stats_start_date: @site_inserted_at
}
test "parses day format" do
@@ -90,7 +91,7 @@ defmodule Plausible.Stats.QueryTest do
end
test "all time shows hourly if site is completely new" do
- site = Map.put(@site, :inserted_at, Timex.now())
+ site = Map.put(@site, :stats_start_date, Timex.now())
q = Query.from(site, %{"period" => "all"})
assert q.date_range.first == Timex.today()
@@ -100,7 +101,7 @@ defmodule Plausible.Stats.QueryTest do
end
test "all time shows daily if site is more than a day old" do
- site = Map.put(@site, :inserted_at, Timex.now() |> Timex.shift(days: -1))
+ site = Map.put(@site, :stats_start_date, Timex.now() |> Timex.shift(days: -1))
q = Query.from(site, %{"period" => "all"})
assert q.date_range.first == Timex.today() |> Timex.shift(days: -1)
@@ -110,7 +111,7 @@ defmodule Plausible.Stats.QueryTest do
end
test "all time shows monthly if site is more than a month old" do
- site = Map.put(@site, :inserted_at, Timex.now() |> Timex.shift(months: -1))
+ site = Map.put(@site, :stats_start_date, Timex.now() |> Timex.shift(months: -1))
q = Query.from(site, %{"period" => "all"})
assert q.date_range.first == Timex.today() |> Timex.shift(months: -1)