How to mock a statement in JEST | Community
Skip to main content
Employee
May 18, 2021 1:05 PM UTC
Solved

How to mock a statement in JEST

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.
BrianKasingli
BrianKasingliAccepted solution
New Participant
Jul 12, 2023 10:16 PM UTC

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
Jul 12, 2023 10:16 PM UTC

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

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

 

Translate