Skip to content
Snippets Groups Projects
Unverified Commit 617eaffc authored by Ryan Laurie's avatar Ryan Laurie Committed by GitHub
Browse files

Fix Time Series Fill When Grouping by Minute (#21323)

* fix minute index

* test specific timeseries intervals
parent 7cc543f3
Branches
Tags
No related merge requests found
......@@ -66,7 +66,7 @@ const TIMESERIES_INTERVALS = [
// mapping from Metabase "unit" to d3 intervals above
const INTERVAL_INDEX_BY_UNIT = {
minute: 1,
minute: 5,
hour: 9,
day: 13,
week: 14,
......
......@@ -155,6 +155,34 @@ describe("visualization.lib.timeseries", () => {
expect(count).toBe(expectedCount);
});
});
const units = ["minute", "hour", "day", "week", "month", "year"];
units.forEach(testUnit => {
it(`should return one ${testUnit} when ${testUnit} interval is set`, () => {
const { interval, count } = computeTimeseriesDataInverval(
[
new Date("2019-01-01").toISOString(),
new Date("2020-01-01").toISOString(),
],
testUnit,
);
expect(interval).toBe(testUnit);
expect(count).toBe(1);
});
});
it("should return 3 months for quarter interval", () => {
const { interval, count } = computeTimeseriesDataInverval(
[
new Date("2019-01-01").toISOString(),
new Date("2020-01-01").toISOString(),
],
"quarter",
);
expect(interval).toBe("month");
expect(count).toBe(3);
});
});
describe("getTimezone", () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment