Files
twenty/packages/twenty-front/src/utils/__tests__/isDeeplyEqual.test.ts
T
martmull da064d5e88 Support define is tool logic function (#17926)
- supports isTool and timeout settings in defineLogicFunction in apps
and in setting tabs definition
- compute for all toolInputSchema for logic funciton, in settings and in
code steps

<img width="991" height="802" alt="image"
src="https://github.com/user-attachments/assets/05dc1221-cac9-45a3-87b0-3b13161446fd"
/>
2026-02-16 10:43:29 +01:00

38 lines
1.3 KiB
TypeScript

import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
describe('isDeeplyEqual', () => {
it('should return true for equal primitives', () => {
expect(isDeeplyEqual(1, 1)).toBe(true);
expect(isDeeplyEqual('hello', 'hello')).toBe(true);
expect(isDeeplyEqual(true, true)).toBe(true);
expect(isDeeplyEqual(null, null)).toBe(true);
expect(isDeeplyEqual(undefined, undefined)).toBe(true);
});
it('should return false for different primitives', () => {
expect(isDeeplyEqual(1, 2)).toBe(false);
expect(isDeeplyEqual('hello', 'world')).toBe(false);
expect(isDeeplyEqual(true, false)).toBe(false);
});
it('should return true for deeply equal objects', () => {
expect(isDeeplyEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } })).toBe(
true,
);
});
it('should return false for different objects', () => {
expect(isDeeplyEqual({ a: 1 }, { a: 2 })).toBe(false);
expect(isDeeplyEqual({ a: 1 }, { b: 1 })).toBe(false);
});
it('should return true for deeply equal arrays', () => {
expect(isDeeplyEqual([1, 2, [3]], [1, 2, [3]])).toBe(true);
});
it('should return false for different arrays', () => {
expect(isDeeplyEqual([1, 2], [1, 3])).toBe(false);
expect(isDeeplyEqual([1, 2], [1, 2, 3])).toBe(false);
});
});