Skip to content Skip to sidebar Skip to footer
Showing posts with the label Jestjs

How Do I Test Call And Apply Functions In Jest?

Here's my callnapply.js file const callAndApply = { caller(object, method, nameArg, ageArg, t… Read more How Do I Test Call And Apply Functions In Jest?

Jest Test Fails For Async Function That Calls Another Async Function

I am trying to test an async function that uses data returned by another async function. Here is th… Read more Jest Test Fails For Async Function That Calls Another Async Function

Jest Failing With Unhelpful Error Message When Throwing New Error

I'm calling this function in my code and throwing an error: myFunction(message) { if (!mess… Read more Jest Failing With Unhelpful Error Message When Throwing New Error

Randomly Failing Tests Jest And Supertest Node.js

so long story short I'm developing RESTapi that takes a movie title on POST request to the /mov… Read more Randomly Failing Tests Jest And Supertest Node.js

Jest Mock Method Of Base Es6 Class (super Method) When Testing Extended Class

I am having issues when testing that the original method (from the base class), is called with some… Read more Jest Mock Method Of Base Es6 Class (super Method) When Testing Extended Class

How Can Enzyme Check For Component Visibility?

I've attached a cut down version of an issue I am having. I have a simple Checkbox which I hide… Read more How Can Enzyme Check For Component Visibility?

How To Setup Jsdom When Working With Jest

I'm trying to migrate from AVA to Jest. In AVA you can set ava.setup, in which you set the jsdo… Read more How To Setup Jsdom When Working With Jest

What Is The State Of The Art For Testing/mocking Functions Within A Module In 2018?

I have a module, for the purposes of learning testing, that looks like this: api.js import axios fr… Read more What Is The State Of The Art For Testing/mocking Functions Within A Module In 2018?

How To Test That An Inner Function Has Been Called From An Imported Function? (with Jest.js)

I'm having issues with Jest testing that a closure (an inner function) has been called after ca… Read more How To Test That An Inner Function Has Been Called From An Imported Function? (with Jest.js)

How Can I Test A Store Singleton?

I already am implementing unit tests using redux-mock-store. I would like to perform an integration… Read more How Can I Test A Store Singleton?

Getting Undefined When I Return Some Response From Mocked Axios Call Using Jest

I'm trying to mock axios call and verify the response, but when I log the response from mocked … Read more Getting Undefined When I Return Some Response From Mocked Axios Call Using Jest

Jest Mock Localstorage Methods

I would like to mock localStorage methods in jest for error simulation. I have localstorage getter … Read more Jest Mock Localstorage Methods

Detox Only Testing Splash Screen

I am running detox on my React-Native project and can only test the splash screen. The splash scree… Read more Detox Only Testing Splash Screen

How To Simulate An Event On A Unit Test With Jest, Enzyme For React-native

I'm trying to figure out how to test an 'onPress' event with Jest in a React-Native app… Read more How To Simulate An Event On A Unit Test With Jest, Enzyme For React-native

Jest: How To Globally Mock Node-uuid (or Any Other Imported Module)

Recently migrated from mocha to jest and I'm running into an issue. I have lots of warnings in … Read more Jest: How To Globally Mock Node-uuid (or Any Other Imported Module)

Jest No Tests Found

running docker mhart/alpine-node:8 on macOS with nodejs (6.10.3-r0) (18/18) yarn 0.24.6 jest … Read more Jest No Tests Found

How Can I Mock A Service Within A React Component To Isolate Unit Tests In Jest?

I'm trying to refactor a unit test to isolate a service that calls an API using axios from the … Read more How Can I Mock A Service Within A React Component To Isolate Unit Tests In Jest?

ReactJS: How To Test For A Ref?

This is a function used in a react component. As you can see I'm using ref to get the focus on … Read more ReactJS: How To Test For A Ref?

Jest Manual Mocking A Package Requiring New Instance

I'm trying to use Jest manual mock to mock the behaviour of a package X used in a project. The… Read more Jest Manual Mocking A Package Requiring New Instance

Mock Node External Module Default With Chained Method Using Jest

In our node CLI we have a simple method: 'use strict'; const ora = require('ora');… Read more Mock Node External Module Default With Chained Method Using Jest