Quantcast
Browsing latest articles
Browse All 2 View Live

Answer by slideshowp2 for Jest - Mock a function getting imported in a...

You can use jest.spyOn(object, methodName) method, here is a completed demo: idnex.tsx: import React, { Component } from 'react'; import { someHelper } from './utils'; class SomeComponent extends...

View Article


Jest - Mock a function getting imported in a component file you're testing

I have a class component that I want to test using jest. That component is using a function getting imported from a utils file. How do I mock that imported function from my main test file?

View Article

Browsing latest articles
Browse All 2 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>