mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Handle Date and RegExp objects in AugmentObject (#5809)
This commit is contained in:
committed by
GitHub
parent
4f91525022
commit
6c35ffa82c
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user