Compare commits
7 Commits
top-report
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
a7603c9e49 | 3 years ago |
|
|
cffff0340c | 3 years ago |
|
|
33eed9d7db | 3 years ago |
|
|
e5b7f1afd0 | 3 years ago |
|
|
f966419a4a | 3 years ago |
|
|
f9f0407d68 | 3 years ago |
|
|
e5b56dbe62 | 3 years ago |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,6 @@
|
|||||||
- "Chrome":
|
- "Chrome":
|
||||||
- "Google Chrome"
|
- "Google Chrome"
|
||||||
|
- "Vewd Browser":
|
||||||
|
- "Vewd Core"
|
||||||
|
- "DuckDuckGo Privacy Browser":
|
||||||
|
- "DuckDuckGo"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
6.2.1
|
6.3.0
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
defmodule PlausibleWeb.Api.StatsController.TopReportTest do
|
|
||||||
use PlausibleWeb.ConnCase
|
|
||||||
|
|
||||||
@user_id 123
|
|
||||||
|
|
||||||
describe "GET /api/stats/top-report" do
|
|
||||||
setup [:create_user, :log_in, :create_new_site]
|
|
||||||
|
|
||||||
test "returns graph and top stats", %{conn: conn, site: site} do
|
|
||||||
populate_stats(site, [
|
|
||||||
build(:pageview, timestamp: ~N[2021-01-11 04:00:00]),
|
|
||||||
build(:pageview, timestamp: ~N[2021-01-11 05:00:00]),
|
|
||||||
build(:pageview, timestamp: ~N[2021-01-11 18:00:00])
|
|
||||||
])
|
|
||||||
|
|
||||||
conn =
|
|
||||||
get(
|
|
||||||
conn,
|
|
||||||
"/api/stats/#{site.domain}/top-report?period=day&date=2021-01-11&metric=pageviews"
|
|
||||||
)
|
|
||||||
|
|
||||||
assert %{"plot" => curr, "top_stats" => top_stats} = json_response(conn, 200)
|
|
||||||
assert [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] = curr
|
|
||||||
|
|
||||||
assert %{
|
|
||||||
"name" => "Unique visitors",
|
|
||||||
"value" => 3,
|
|
||||||
"graph_metric" => "visitors"
|
|
||||||
} in top_stats
|
|
||||||
end
|
|
||||||
|
|
||||||
test "always adds comparison for top stats"
|
|
||||||
test "compares both top stats and graph when requested"
|
|
||||||
|
|
||||||
test "overrides metric with default when invalid metric provided", %{site: site, conn: conn} do
|
|
||||||
# requires goal filter
|
|
||||||
conn = get(conn, "/api/stats/#{site.domain}/top-report?period=day&metric=events")
|
|
||||||
assert %{"metric" => "visitors"} = json_response(conn, 200)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "overrides interval with default when invalid interval provided"
|
|
||||||
test "custom date range interval handling"
|
|
||||||
test "all time date range interval handling"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
Reference in New Issue