mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Add new 'is empty' and 'is not empty' operators to Filter (#8445)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -250,6 +250,38 @@ describe('FilterParameter', () => {
|
||||
});
|
||||
|
||||
describe('string', () => {
|
||||
it.each([
|
||||
{ left: null, expected: true },
|
||||
{ left: undefined, expected: true },
|
||||
{ left: '', expected: true },
|
||||
{ left: '🐛', expected: false },
|
||||
])('string:empty($left) === $expected', ({ left, expected }) => {
|
||||
const result = executeFilter(
|
||||
filterFactory({
|
||||
conditions: [
|
||||
{ id: '1', leftValue: left, operator: { operation: 'empty', type: 'string' } },
|
||||
],
|
||||
}),
|
||||
);
|
||||
expect(result).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ left: null, expected: false },
|
||||
{ left: undefined, expected: false },
|
||||
{ left: '', expected: false },
|
||||
{ left: '🐛', expected: true },
|
||||
])('string:notEmpty($left) === $expected', ({ left, expected }) => {
|
||||
const result = executeFilter(
|
||||
filterFactory({
|
||||
conditions: [
|
||||
{ id: '1', leftValue: left, operator: { operation: 'notEmpty', type: 'string' } },
|
||||
],
|
||||
}),
|
||||
);
|
||||
expect(result).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ left: 'first string', right: 'first string', expected: true },
|
||||
{ left: 'first string', right: 'second string', expected: false },
|
||||
|
||||
Reference in New Issue
Block a user