fix(explore): Incorrect conversion from simple bool filter to custom sql (#21293)

This commit is contained in:
Kamil Gabryjelski
2022-09-01 17:06:42 +02:00
committed by GitHub
parent eb805682e2
commit 076af6003a
2 changed files with 9 additions and 4 deletions

View File

@@ -66,10 +66,10 @@ export function optionLabel(opt) {
return EMPTY_STRING;
}
if (opt === true) {
return '<true>';
return TRUE_STRING;
}
if (opt === false) {
return '<false>';
return FALSE_STRING;
}
if (typeof opt !== 'string' && opt.toString) {
return opt.toString();

View File

@@ -21,6 +21,8 @@ import {
optionFromValue,
prepareCopyToClipboardTabularData,
NULL_STRING,
TRUE_STRING,
FALSE_STRING,
} from 'src/utils/common';
describe('utils/common', () => {
@@ -28,9 +30,12 @@ describe('utils/common', () => {
it('converts values as expected', () => {
expect(optionFromValue(false)).toEqual({
value: false,
label: '<false>',
label: FALSE_STRING,
});
expect(optionFromValue(true)).toEqual({
value: true,
label: TRUE_STRING,
});
expect(optionFromValue(true)).toEqual({ value: true, label: '<true>' });
expect(optionFromValue(null)).toEqual({
value: NULL_STRING,
label: NULL_STRING,