Closed nellh closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.46%. Comparing base (
53fdba6
) to head (ff91e2e
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
ChatGPT's suggestion:
describe('Object pollution test', () => {
beforeAll(() => {
// Simulate the polluting library
Object.defineProperty(Object.prototype, 'global', {
get: function() {
return globalThis;
},
configurable: true
});
});
afterAll(() => {
// Clean up the pollution
delete Object.prototype.global;
});
test('should handle maps with global key correctly', () => {
const myMap = new Map();
const globalKey = 'global';
expect(() => {
myMap.set(globalKey, 'someValue');
}).not.toThrow();
expect(myMap.get(globalKey)).toBe('someValue');
});
// Additional tests to verify your patch
});
This avoids the loop iterating over non-enumerable properties of jsonObject.