Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,28 @@ Unexpected " ".`,
},
},

{
title: "Time range only with default grain",
url: "http://localhost/explore/AdBids_explore?tr=7D",
errors: [],
entity: {
selectedTimeRange: {
interval: "TIME_GRAIN_DAY",
name: "7D",
} as DashboardTimeControls,
},
},
{
title: "Time range only with no default grain",
url: "http://localhost/explore/AdBids_explore?tr=inf",
errors: [],
entity: {
selectedTimeRange: {
interval: "TIME_GRAIN_HOUR",
name: "inf",
} as DashboardTimeControls,
},
},
{
title: "Invalid time ranges",
url: "http://localhost/explore/AdBids_explore?tr=abc&grain=xyz",
Expand Down Expand Up @@ -131,7 +153,12 @@ Unexpected " ".`,
},
];

describe("Invalid Human readable URL State", () => {
/**
* Has tests that call convertURLSearchParamsToExploreState directly.
* Unlike url-state-variations that tests actions on explore state.
* TODO: find a good unification of test cases so that a single set of cases run all variations.
*/
describe("direct convertURLSearchParamsToExploreState variations", () => {
beforeEach(() => {
metricsExplorerStore.remove(AD_BIDS_EXPLORE_NAME);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,9 @@ export function fromTimeRangesParams(

if (grain && grain in V1TimeGrainToDateTimeUnit) {
preset.timeGrain = V1TimeGrainToDateTimeUnit[grain];
} else {
errors.push(getSingleFieldError("time grain", grain ?? "undefined"));
} else if (grain) {
Comment thread
AdityaHegde marked this conversation as resolved.
// Only throw error if grain is defined
errors.push(getSingleFieldError("time grain", grain));
}
} catch {
// ignore
Expand Down
Loading