mirror of
https://github.com/apache/superset.git
synced 2026-04-28 04:25:07 +00:00
fix: null value and empty string in filter (#18171)
This commit is contained in:
@@ -16,7 +16,9 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { EMPTY_STRING, NULL_STRING } from 'src/utils/common';
|
||||
import { getSimpleSQLExpression } from '.';
|
||||
import { Operators } from '../constants';
|
||||
|
||||
const params = {
|
||||
subject: 'subject',
|
||||
@@ -36,6 +38,12 @@ test('Should return "" if subject is falsy', () => {
|
||||
).toBe('');
|
||||
});
|
||||
|
||||
test('Should return null string and empty string', () => {
|
||||
expect(getSimpleSQLExpression(params.subject, Operators.IN, [null, ''])).toBe(
|
||||
`subject ${Operators.IN} (${NULL_STRING}, ${EMPTY_STRING})`,
|
||||
);
|
||||
});
|
||||
|
||||
test('Should return subject if operator is falsy', () => {
|
||||
expect(getSimpleSQLExpression(params.subject, '', params.comparator)).toBe(
|
||||
params.subject,
|
||||
|
||||
Reference in New Issue
Block a user