Jest Unit Testing function that calls a second one that returns a promise

Edited Question with vazsonyidl suggestions applied I have to write unit tests for a function similar to this one: import {External} from ‘ExternalModule’; async functionA(){ this.functionB()….

Cypress: Using cy.intercept() to check if a call hasnt been made yet?

Using cy.intercept() to intercept (and stub) a couple of network requests (to google tag manager), but would like to test at an early point in my test before I expect them to be called. How would I …

mock post method npm request module with jest

I know that npm request module is now deprecated, but i want to mock a post http call with jest. Here is my function import { post } from ‘request’; export functionToFetch(uriFetching) { return …

How do I run a beforeEach in Cypress?

I’m currently building a test, and it seems that after the second and third test, the beforeEach is not getting the information that I need and is telling me that I’m having the following issue: cy….

How to log response status log in postman

How do I console the response status code in Postman ? I have this snippet here: pm.test(“Status code is 200”, function () { pm.response.to.have.status(200); }); I want to log response …

Mocha test false assert timeouts

I have some problem with my async mocha tests. The assert method within a promise results in a timeout when the input evaluates to false. (with true values it works fine) This is a simplified version …

Console.log from a class’ function

I want to test if my function inside my class returns the given sentence. But if I try to test using console.log, it returns ReferenceError: rev is not defined. What am I doing wrong? class store { …

How to test method called in promise

I have a function that saves an entity and in the promise i want to check the delete is called. In my jest test it whizzes past and can’t think how to test it Here is the partial snippets, it all …

Test clearing of search input field on submit (after fetching)

I want to test that a search box does calls a handler (passed as prop) with the fetched results and resets the input field afterwards. import React, { useState } from ‘react’ import Axios from ‘axios’ …

Lightweight web browser for testing

I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered and Javascript is executed, then kill the whole thing and restart. I don’t care about how the page renders graphically at all. Which browser or tool should I use for this? Ideally it should be something self-contained that doesn’t require