How to mock a statement in JEST | Community
Skip to main content
Adobe 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
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 12, 2023

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

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