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

Better filter validity check (#23492)

* better filter validity check
parent 9c4e7389
No related branches found
No related tags found
No related merge requests found
...@@ -101,6 +101,9 @@ export default class Filter extends MBQLClause { ...@@ -101,6 +101,9 @@ export default class Filter extends MBQLClause {
return false; return false;
} }
if (!this.operatorName()) {
return false;
}
const operator = this.operator(); const operator = this.operator();
if (operator) { if (operator) {
......
...@@ -31,6 +31,11 @@ describe("Filter", () => { ...@@ -31,6 +31,11 @@ describe("Filter", () => {
false, false,
); );
}); });
it("should return false with a null operator", () => {
expect(
filter([null, ["field", ORDERS.TOTAL.id, null], 42]).isValid(),
).toBe(false);
});
it("should return true for a filter with an expression for the field", () => { it("should return true for a filter with an expression for the field", () => {
expect( expect(
filter(["=", ["/", ["field", 12341234, null], 43], 42]).isValid(), filter(["=", ["/", ["field", 12341234, null], 43], 42]).isValid(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment