mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
Fix tests
This commit is contained in:
parent
e572877cdd
commit
25baa6bae9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user