Relative Content

Tag Archive for jestjs

What does this Jest beforeEach do?

beforeEach(() => { mockAxiosFunc.post.mockImplementation((addres) => { if(addres == XXXX) { return Promise.resolve({res: XXXX}) } return Promise.reject(XXXX) }) }) I checked the relevant code and there does not seem to be a trigger either jestjs New contributor cindy is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out […]

Best practices for duplicate tests with different data

Let’s say that I have a test that needs to be run with different sets of data. In the example below, the two tests are actually doing the same thing. The only difference is the data that’s being passed in. In addition, there are essentially two different parameters being passed in to each test: either dataset1 or dataset2, and then there are the values coming from the .each() call.