Skip to content

Commit

Permalink
Fix tests, lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Apr 1, 2024
1 parent c5a50ff commit c5589b2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
5 changes: 3 additions & 2 deletions app/analytics/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export class AnalyticsEngineAPI {
// like double1 (isVisitor) or double2 (isSession/isVisit). This
// is just a limitation of Cloudflare Analytics Engine.
// -- but you can filter on them (using WHERE)

const query = `
SELECT SUM(_sample_interval) as count,
Expand Down Expand Up @@ -264,7 +265,7 @@ export class AnalyticsEngineAPI {
// defaults to 1 day if not specified
const siteIdColumn = ColumnMappings["siteId"];

let intervalSql = intervalToSql(interval, tz);
const intervalSql = intervalToSql(interval, tz);

const query = `
SELECT SUM(_sample_interval) as count,
Expand Down Expand Up @@ -493,7 +494,7 @@ export class AnalyticsEngineAPI {

limit = limit || 10;

let intervalSql = intervalToSql(interval, tz);
const intervalSql = intervalToSql(interval, tz);

const query = `
SELECT SUM(_sample_interval) as count,
Expand Down
52 changes: 27 additions & 25 deletions app/routes/dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe("Dashboard route", () => {
// response for getViewsGroupedByInterval
fetch.mockResolvedValueOnce(
createFetchResponse({
data: [{ bucket: "2024-01-11 00:00:00", count: 4 }],
data: [{ bucket: "2024-01-11 05:00:00", count: 4 }],
}),
);

Expand Down Expand Up @@ -212,16 +212,17 @@ describe("Dashboard route", () => {
countByBrowser: [["Chrome", 2]],
countByDevice: [["Desktop", 3]],
viewsGroupedByInterval: [
["2024-01-11 00:00:00", 4],
["2024-01-12 00:00:00", 0],
["2024-01-13 00:00:00", 0],
["2024-01-14 00:00:00", 0],
["2024-01-15 00:00:00", 0],
["2024-01-16 00:00:00", 0],
["2024-01-17 00:00:00", 0],
["2024-01-18 00:00:00", 0],
["2024-01-11 05:00:00", 4],
["2024-01-12 05:00:00", 0],
["2024-01-13 05:00:00", 0],
["2024-01-14 05:00:00", 0],
["2024-01-15 05:00:00", 0],
["2024-01-16 05:00:00", 0],
["2024-01-17 05:00:00", 0],
["2024-01-18 05:00:00", 0],
],
intervalType: "DAY",
interval: "7d",
});
});

Expand Down Expand Up @@ -265,16 +266,17 @@ describe("Dashboard route", () => {
countByBrowser: [],
countByDevice: [],
viewsGroupedByInterval: [
["2024-01-11 00:00:00", 0],
["2024-01-12 00:00:00", 0],
["2024-01-13 00:00:00", 0],
["2024-01-14 00:00:00", 0],
["2024-01-15 00:00:00", 0],
["2024-01-16 00:00:00", 0],
["2024-01-17 00:00:00", 0],
["2024-01-18 00:00:00", 0],
["2024-01-11 05:00:00", 0],
["2024-01-12 05:00:00", 0],
["2024-01-13 05:00:00", 0],
["2024-01-14 05:00:00", 0],
["2024-01-15 05:00:00", 0],
["2024-01-16 05:00:00", 0],
["2024-01-17 05:00:00", 0],
["2024-01-18 05:00:00", 0],
],
intervalType: "DAY",
interval: "7d",
});
});
});
Expand Down Expand Up @@ -344,14 +346,14 @@ describe("Dashboard route", () => {
["Tablet", 60],
],
viewsGroupedByInterval: [
["2024-01-11 00:00:00", 0],
["2024-01-12 00:00:00", 0],
["2024-01-13 00:00:00", 3],
["2024-01-14 00:00:00", 0],
["2024-01-15 00:00:00", 0],
["2024-01-16 00:00:00", 2],
["2024-01-17 00:00:00", 1],
["2024-01-18 00:00:00", 0],
["2024-01-11 05:00:00", 0],
["2024-01-12 05:00:00", 0],
["2024-01-13 05:00:00", 3],
["2024-01-14 05:00:00", 0],
["2024-01-15 05:00:00", 0],
["2024-01-16 05:00:00", 2],
["2024-01-17 05:00:00", 1],
["2024-01-18 05:00:00", 0],
],
intervalType: "day",
};
Expand Down

0 comments on commit c5589b2

Please sign in to comment.