How to mock a statement in JEST | Community
Skip to main content
Employee
May 18, 2021
Solved

How to mock a statement in JEST

  • May 18, 2021
  • 1 reply
  • 731 views

Hi,

 

I have the following statement in my client library function

$(window).adaptTo("foundation-ui");

 

I am not able to understand how to mock this line in JEST so that it skips this line

Please can anybody help

Thanks

Tarini

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

You'd ned to mock the adapTo function like the example below:

$.fn.adaptTo = jest.fn().mockImplementation(() => { // Mock implementation goes here });

 

1 reply

BrianKasingli
BrianKasingliAccepted solution
New Participant
July 12, 2023

You'd ned to mock the adapTo function like the example below:

$.fn.adaptTo = jest.fn().mockImplementation(() => { // Mock implementation goes here });