mock-knex icon indicating copy to clipboard operation
mock-knex copied to clipboard

Protect replace from modifying the prototype

Open danthegoodman opened this issue 2 years ago • 0 comments
trafficstars

mock(Knex) is storing the original functions on a replacement object, but when being set lodash is storing it on the real object prototype. This change modifies the replacement storage to put the function on a renamed prototype object much like the constructor.

This allows unmock(Knex) to properly restore all mocked functions.

Fixes #126

danthegoodman avatar Dec 13 '22 18:12 danthegoodman