Skip to content

Commit

Permalink
Add test in shimmer wrap to preserve function name (#3237)
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-id authored and nsavoire committed Jun 20, 2023
1 parent 99b9f61 commit 405d58f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/datadog-shimmer/test/shimmer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {} }

Expand Down Expand Up @@ -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 = () => {}

Expand Down

0 comments on commit 405d58f

Please sign in to comment.