Compare commits
25 Commits
master
...
top-report
| Author | SHA1 | Date |
|---|---|---|
|
|
d838e536d8 | 3 years ago |
|
|
26c3bf409a | 3 years ago |
|
|
fe307466e3 | 3 years ago |
|
|
4244fbf1e1 | 3 years ago |
|
|
26c7a5ec0d | 3 years ago |
|
|
2a66968ab1 | 3 years ago |
|
|
28c30aa531 | 3 years ago |
|
|
f4298328e6 | 3 years ago |
|
|
baec7d5d08 | 3 years ago |
|
|
2bf05d685e | 3 years ago |
|
|
84520260dd | 3 years ago |
|
|
af7d125049 | 3 years ago |
|
|
48a01cadc9 | 3 years ago |
|
|
3a93f780c9 | 3 years ago |
|
|
852ba216f0 | 3 years ago |
|
|
5243228c96 | 3 years ago |
|
|
ce5fe91dcc | 3 years ago |
|
|
b9c5fde663 | 3 years ago |
|
|
1aace861fe | 3 years ago |
|
|
2054d50d29 | 3 years ago |
|
|
2c1ed2eba2 | 3 years ago |
|
|
01966613e0 | 3 years ago |
|
|
09f9d5abfa | 3 years ago |
|
|
5cace1b173 | 3 years ago |
|
|
182226e7f3 | 3 years ago |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
|||||||
6.3.0
|
6.2.1
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
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