mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(core): AugmentObject should check for own propeties correctly (#12534)
This commit is contained in:
committed by
GitHub
parent
5f1adefca7
commit
0cdf393743
@@ -572,5 +572,22 @@ describe('AugmentObject', () => {
|
||||
expect('z' in augmentedObject.x).toBe(true);
|
||||
expect('y' in augmentedObject.x).toBe(true);
|
||||
});
|
||||
|
||||
test('should ignore non-enumerable keys', () => {
|
||||
const originalObject: { toString?: string } = { toString: '123' };
|
||||
const augmentedObject = augmentObject(originalObject);
|
||||
expect('toString' in augmentedObject).toBe(true);
|
||||
expect(Object.keys(augmentedObject)).toEqual(['toString']);
|
||||
expect(Object.getOwnPropertyDescriptor(augmentedObject, 'toString')?.value).toEqual(
|
||||
originalObject.toString,
|
||||
);
|
||||
expect(augmentedObject.toString).toEqual(originalObject.toString);
|
||||
|
||||
augmentedObject.toString = '456';
|
||||
expect(augmentedObject.toString).toBe('456');
|
||||
|
||||
delete augmentedObject.toString;
|
||||
expect(augmentedObject.toString).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user