@uifabric/utilities
Version:
Fluent UI React utilities for building components.
1 lines • 886 B
Source Map (JSON)
{"version":3,"file":"setRenderSpy.js","sourceRoot":"../src/","sources":["test/setRenderSpy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,IAAI,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { ReactWrapper } from 'enzyme';\nimport * as sinon from 'sinon';\n\n/**\n * Replaces the enzyme render function with a spy that can be used to count how many\n * times the render function was called in a test.\n * @param wrapper - The wrapper around the component instance for which you want to spy upon\n */\nexport function setRenderSpy(wrapper: ReactWrapper<{}, {}>): sinon.SinonSpy {\n let spy = sinon.spy(wrapper.instance().render);\n wrapper.instance().render = spy;\n return spy;\n}\n"]}