property-replacer
Write javascript unit tests where you can safely replace object properties and undo the replacement on teardown. Inspired by perl Test::Resub and python redef
Installation
npm install property-replacer
Usage
Replacer.replace(object, key, anything); --> replace any key on an object with anything. Replacer.reset(); --> put all replaced properties back to normal.
var Replacer = ;// some constructorvar {};Catprototype { return 'meow'; }; Replacer;var cat = ;var meow = cat;// returns bark! Replacer;meow = cat;// returns meow