mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Compare Datasets Node): UI tweaks and fixes
This commit is contained in:
31
packages/nodes-base/test/utils/utilities.test.ts
Normal file
31
packages/nodes-base/test/utils/utilities.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { fuzzyCompare } from '../../utils/utilities';
|
||||
|
||||
//most test cases for fuzzyCompare are done in Compare Datasets node tests
|
||||
describe('Test fuzzyCompare', () => {
|
||||
it('should do strict comparison', () => {
|
||||
const compareFunction = fuzzyCompare(false);
|
||||
|
||||
expect(compareFunction(1, '1')).toEqual(false);
|
||||
});
|
||||
|
||||
it('should do fuzzy comparison', () => {
|
||||
const compareFunction = fuzzyCompare(true);
|
||||
|
||||
expect(compareFunction(1, '1')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should treat null, 0 and "0" as equal', () => {
|
||||
const compareFunction = fuzzyCompare(true, 2);
|
||||
|
||||
expect(compareFunction(null, null)).toEqual(true);
|
||||
expect(compareFunction(null, 0)).toEqual(true);
|
||||
expect(compareFunction(null, '0')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not treat null, 0 and "0" as equal', () => {
|
||||
const compareFunction = fuzzyCompare(true);
|
||||
|
||||
expect(compareFunction(null, 0)).toEqual(false);
|
||||
expect(compareFunction(null, '0')).toEqual(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user