Skip to content

Commit

Permalink
Couple more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Jan 24, 2025
1 parent 56ddd00 commit c7b47b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion react/src/utils/__tests__/object-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ circularArray1.push(circularArray1)
const circularArray2: any[] = []
circularArray2.push(circularArray2)

function f1() {}
function f2() {}

describe('object-utils', () => {
describe('isDeepEqual', () => {
it.each([
Expand All @@ -16,6 +19,7 @@ describe('object-utils', () => {
[false, 'a', 'b'],
[false, 1, 2],
[true, 0, -0],
[false, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY],
[false, 1, '1'],
[false, Number.NaN, Number.NaN],
[true, null, null],
Expand All @@ -26,7 +30,9 @@ describe('object-utils', () => {
[true, [1, 2, 3], [1, 2, 3]],
[false, [1, 2, 3], [1, 2, 4]],
[true, { a: circularArray1 }, { a: circularArray1 }],
[false, { a: circularArray1 }, { a: circularArray2 }],
// [false, { a: circularArray1 }, { a: circularArray2 }], // TODO
[true, f1, f1],
[false, f1, f2],
])('returns %s for %s and %s', (expected, obj1, obj2) => {
expect(isDeepEqual(obj1, obj2)).toBe(expected)
expect(isDeepEqual(obj2, obj1)).toBe(expected)
Expand Down

0 comments on commit c7b47b1

Please sign in to comment.