Questions tagged [jest]

The tag has no usage guidance.

3
votes
1answer
32 views

Is Jest mandatory in LWC For appExchange app

As SF stated Jest is independent of Salesforce and doesn't run in web browser. Is it mandatory to write coverage/unit testing for Lightning Web Components and add in bundle while creating manage ...
2
votes
1answer
36 views

Run Single Test for Lightning Web Component

I feel like this is a stupid question, but I can't find the answer anywhere. Is there a way to run a single test file for a single Lightning Web Component. I essentially want to be able to pass ...
2
votes
1answer
72 views

How can I test the click of a button that calls an Apex method, and makes the component show a toast?

The component itself, when loaded, queries some data from the database. Then, depending on what it finds, loads the specific template. One of those has a button, which will call the server again, and ...
5
votes
1answer
101 views

How to mock navigator.geolocation in a LWC?

Having a component that uses the embedded geolocation feature to get coordinates, how can I mock the call in a Jest test? The component's code work in the org: ... get locationService () { ...
1
vote
1answer
112 views

How to test LWC onsuccess event handler in Jest

I'm looking for help writing jest test for my onsuccess event handler for my lightning-record-edit form. I'm new to jest so forgive me if this is covered somewhere else, I just haven't been able to ...
5
votes
1answer
54 views

How can I make sure, in an unit test, that I have the correct data in a lightning-map component?

If I have a property called markers in my component, which is exposed using the @api notation. How can I make sure that it contains the correct values after the component goes through the jest unit ...