I have a simple test using vitest that is comparing a simple array with single item with same array. Here is the code.
import '@testing-library/jest-dom'
import { describe, it, expect } from 'vitest';
describe('Simple Test', () => {
it('Test simple assertion', () => {
expect([
{
id: "key1",
header: "key1",
cell: (e) => e["key1"], <== This is the problematic line
},
]).toEqual([
{
id: "key1",
header: "key1",
cell: (e) => e["key1"], <== This is the problematic line
},
]);
});
});
The issue I'm facing is that assertion is failing with following error. If I comment out the above cell attribute in each of the array, the assertion is succeeding.
AssertionError: expected [ Array(1) ] to deeply equal [ Array(1) ]
at /Volumes/Code/Nexus-BCM/src/Nexus-UCM/test/react/widgets/ListWidget.test.tsx:53:8
Can anyone suggest how I can make this assertion succeed?