Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

How to mock a statement in JEST

Avatar

Employee

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

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

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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

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