Skip to content

Commit 7968504

Browse files
committed
fix pages_test.exs
1 parent ab2636a commit 7968504

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

assets/js/dashboard/stats/breakdowns.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export function formatDateRangeLabel([from, to]: [string, string]): string {
9393
const toDay = dayjs(to.slice(0, 19))
9494
if (fromDay.isSame(toDay, 'day')) return fromDay.format('D MMM YYYY')
9595
if (fromDay.isSame(toDay, 'year'))
96-
return `${fromDay.format('D MMM')} ${toDay.format('D MMM YYYY')}`
97-
return `${fromDay.format('D MMM YY')} ${toDay.format('D MMM YY')}`
96+
return `${fromDay.format('D MMM')} - ${toDay.format('D MMM YYYY')}`
97+
return `${fromDay.format('D MMM YY')} - ${toDay.format('D MMM YY')}`
9898
}
9999

100100
export function useBodyPortalRef() {

test/plausible_web/controllers/api/stats_controller/pages_test.exs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,9 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
637637
%{"dimensions" => ["/firefox"], "metrics" => [2, 100.0]}
638638
]
639639

640-
assert json_response(conn, 200)["meta"] == %{"date_range_label" => "1 Jan 2021"}
640+
assert %{
641+
"date_range" => ["2021-01-01T00:00:00Z", "2021-01-01T23:59:59Z"]
642+
} = response["query"]
641643
end
642644

643645
test "returns top pages with :not_member filter on custom pageview props including (none) value",
@@ -1236,6 +1238,7 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
12361238
query_pages(conn, site,
12371239
date_range: ["2021-01-01", "2021-01-01"],
12381240
filters: [["contains", "event:page", ["/blog/(/", "/blog/)/"]]],
1241+
order_by: [["visitors", "desc"], ["event:page", "asc"]],
12391242
metrics: @detailed_metrics
12401243
)
12411244

@@ -1925,10 +1928,10 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
19251928
}
19261929
]
19271930

1928-
assert json_response(conn, 200)["meta"] == %{
1929-
"date_range_label" => "2 Jan 2021",
1930-
"comparison_date_range_label" => "1 Jan 2021"
1931-
}
1931+
assert %{
1932+
"comparison_date_range" => ["2021-01-01T00:00:00Z", "2021-01-01T23:59:59Z"],
1933+
"date_range" => ["2021-01-02T00:00:00Z", "2021-01-02T23:59:59Z"]
1934+
} = response["query"]
19321935
end
19331936

19341937
on_ee do

0 commit comments

Comments
 (0)