Skip to content

Commit 5b0dd48

Browse files
committed
Update jest test to include Date/RegExp tests
1 parent 8acc9e1 commit 5b0dd48

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/unit/fastMergeTest.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ describe('fastMerge', () => {
127127
expect(result).toEqual(testObjectWithNullValuesRemoved);
128128
});
129129

130+
it('should replace Date objects', () => {
131+
const oldDate = new Date('2024-01-01');
132+
const newDate = new Date('2025-01-01');
133+
const result = utils.fastMerge(oldDate, newDate);
134+
expect(result.result).toEqual(newDate);
135+
});
136+
137+
it('should replace RegExp objects', () => {
138+
const oldRegex = /old/gi;
139+
const newRegex = /new/i;
140+
const result = utils.fastMerge(oldRegex, newRegex);
141+
expect(result.result).toEqual(newRegex);
142+
});
143+
130144
it('should add the "ONYX_INTERNALS__REPLACE_OBJECT_MARK" flag to the merged object when the change is set to null and "objectRemovalMode" is set to "mark"', () => {
131145
const result = utils.fastMerge(testMergeChanges[1], testMergeChanges[0], {
132146
shouldRemoveNestedNulls: true,

0 commit comments

Comments
 (0)