export const debounce = jest.fn().mockImplementation(
  function (callback, delay) {
    var timer
    let thisArg
    return function (...args) {
      clearTimeout(timer)
      thisArg = this
      var args = [].slice.call(arguments)
      timer = setTimeout(function () {
        callback.apply(thisArg, args)
      }, 100)
    }
  })

export const debounce = jest.fn().mockImplementation(
  function (callback, delay) {
    var timer
    return function (...args) {
      clearTimeout(timer)
      var args = [].slice.call(arguments)
      timer = setTimeout(() => {
        callback.apply(this, args)
      }, 100)
    }
  })

Use arrow function in debounce mock
Use arrow function in debounce mock

In arrow functions, 'this' defaults to the enclosing scope.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#this_and_Arrow_Functions
