fix(core): Handle Date and RegExp objects in AugmentObject (#5809)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-29 21:36:56 +02:00
committed by GitHub
parent 4f91525022
commit 6c35ffa82c
2 changed files with 34 additions and 27 deletions

View File

@@ -193,11 +193,15 @@ describe('AugmentObject', () => {
describe('augmentObject', () => {
test('should work with simple values on first level', () => {
const date = new Date(1680089084200);
const regexp = new RegExp('^test$', 'ig');
const originalObject: IDataObject = {
1: 11,
2: '22',
a: 111,
b: '222',
d: date,
r: regexp,
};
const copyOriginal = JSON.parse(JSON.stringify(originalObject));
@@ -221,7 +225,7 @@ describe('AugmentObject', () => {
augmentedObject.c = 3;
expect(originalObject).toEqual(copyOriginal);
expect({ ...originalObject, d: date.toJSON(), r: {} }).toEqual(copyOriginal);
expect(augmentedObject).toEqual({
1: 911,
@@ -229,6 +233,8 @@ describe('AugmentObject', () => {
a: 9111,
b: '9222',
c: 3,
d: date,
r: regexp,
});
});