const isSpy = (func) => {
  return func.__spy
}

export const spyify = (object, methodName, callback = () => {}) => {
  if (!isSpy(object[methodName])) object['_original' + methodName] = object[methodName]
  object[methodName] = spy(function () {
    const ret = object['_original' + methodName](...arguments)
    if (callback) return callback(...arguments, ret)
    return ret
  })
}

export const mockify = (object, methodName, func) => {
  if (!isSpy(object[methodName])) object['_original' + methodName] = object[methodName]
  object[methodName] = spy(func)
}

export const unspyify = (object, methodName) => {
  if (object['_original' + methodName]) {
    object[methodName] = object['_original' + methodName]
  }
}

@@ -21,19 +21,10 @@
  =%3E 
-%7B%0A  return 
+!!
 func
@@ -29,18 +29,16 @@
 nc.__spy
-%0A%7D
 %0A%0Aexport

Coerse the isSpy function into a boolean