Testing your LWCs
While Salesforce still has more than one approach for developing Lightning components, we’re going to focus on testing LWCs, rather than the older Aura components. Salesforce introduced LWCs in December 2018, with the release of Salesforce’s Spring ’19 version. This was announced in a blog post by Salesforce on December 13, 2018, titled Introducing Lightning Web Components, available at https://developer.salesforce.com/blogs/2018/12/introducing-lightning-web-components.
When it comes to testing LWCs, we can take advantage of the fact that the architecture of this type of component is based on more common JavaScript standards and an open framework. This allows us to write our unit tests using the popular Jest testing framework (https://jestjs.io/), which is already used in the wider JavaScript community outside of Salesforce too. Jest is itself written in JavaScript and uses the Node.js engine to execute, and npm for installation and to manage...