diff --git a/packages/datadog-shimmer/test/shimmer.spec.js b/packages/datadog-shimmer/test/shimmer.spec.js index 534c74dac35..afe475762c1 100644 --- a/packages/datadog-shimmer/test/shimmer.spec.js +++ b/packages/datadog-shimmer/test/shimmer.spec.js @@ -132,6 +132,14 @@ describe('shimmer', () => { expect(obj.count).to.have.length(3) }) + it('should preserve the original function name', () => { + const obj = { count (a, b, c) {} } + + shimmer.wrap(obj, 'count', () => () => {}) + + expect(obj.count).to.have.property('name', 'count') + }) + it('should inherit from the original prototype', () => { const obj = { count: () => {} } @@ -301,6 +309,14 @@ describe('shimmer', () => { expect(wrapped).to.have.length(3) }) + it('should preserve the original function name', () => { + const count = function count (a, b, c) {} + + const wrapped = shimmer.wrap(count, () => {}) + + expect(wrapped).to.have.property('name', 'count') + }) + it('should inherit from the original prototype', () => { const count = () => {}