Category "jestjs"

Start jest in watch mode without executing any tests

I have a lot of test files in my project, and I would like to know how can I start jest in watch mode without executing any tests automatically? Because, as of

What is the best way to test secure routes on APIs that requires authentication while using Cognito OAuth with MFA?

I am using AWS Cognito with MFA and I can't use an actual user with a session to test the routes in with supertest testcases. What is the best practice for test

Is there any way to mock API responses using snapshots?

I'm currently trying to find a good way to mock API responses for a subset of end-to-end tests, and was thinking it would be swell if there was a way to take sn

Babel (expo) avoid compiling some dev only packages

Currently I have to use some cookie jar to make axios work in jest. axios.defaults.headers.post['Content-Type'] = 'application/json' axios.defaults.headers.comm

How to test a DatePicker component using Jest?

Here is the component to test, its a DatePicker component: import { useState } from 'react'; import { useFormContext } from '../Form'; import Textbox from '../T

How to test a function inside useEffect with Jest and Enzyme?

I am testing my components using jest and enzyme. I want to load my component when the whole page is loaded so I am using load event inside useEffect, here is m

Jest Memory Leak when running test cases on redux connected components

When I run my jest tests, I got the following error , this particularly happens with the redux connected components and forwardRef:true is one parameters of the

How to mock a quasar component

This is my code for a quasar component that I want to mock emits: [ "buyer-protection", ...useDialogPluginComponent.emits ] But I get the following error: Type

mocking database calls in api routes

I am building a full stack application with NextJS and a MySQL database.In my API routes I make calls to this database (for example, createOne() for creating an

Mock 'S3' feature of 'aws-sdk' (nodeJS and Jest)

I need to test a file in charge of retrieving data from S3 through the 'aws-sdk' (nodeJs + Jest). The file is: const AWS = require('aws-sdk'); let S3 = null;

How to prevent Jest from combining results?

I currently have two jest test cases the first one passes, but the second fails because its adding the sum of the previous case to that one test('Subtotal to be

How do you test a form upon the submission addEventListener with jest without a framework only vanilla JS

Most of the research I have done in regards to jest testing unit testing and/or integration testing is all heavily geared towards React. But I am not using reac

jest supertest with express-session

I want to test my routes with jest but I don't know how to mock or simulate a session in my test to pass the first if line 2 app.get('/getMailSuiviList', (req,

Jest test does not find provided route

Started working on a new application and decided to write tests from very early stage to avoid any future mistakes. However, little bit struggling I guess with

Test react custom hook with mocking blob response

I have a created a hook as following: import { AxiosResponse } from 'axios'; import { DEFAULT_EXPORT_FILE_NAME } from 'constants'; import { useRef, useState } f

Running a single test in WebStorm using Jest

I'm trying to run single test in my project. However every time I use triangle run icon WebStorm creates new configuration for me. I'm adding screenshots to cla

Unexpected Jest Errors when Mocking Uppy

I'm attempting to mock the Uppy class from the uppy package in a Jest unit test following guidance from this previously answered question. My failing code is be

Jest tests breaks when calling getState outside a component in React

A bunch of my tests suddenly started breaking when I use store.getState() inside a function in React. If I log the store, the store exists but it is still break

Cannot get React testing Jest-DOM to select a date from a date picker or time from a time picker

I cannot, for the life of me, figure out how to get Jest-dom in react testing to select a date picker and the same for the time picker. All my other fields are

Error in Jest Test with Vanilla Javascript: expect(jest.fn()).toBeCalledWith(...expected) Expected: "click", Any<Function> Number of calls: 0

Looks like click method is not getting triggered I have tried evreything, it would be appreciated if someone knows the answer I'm getting this error: expect(jes