Loading tutorials
npm run test:unit runs and passes, with no Salesforce org connection.2 min readdescribe, it, expect, jest.fn), and promises with async/await. It also assumes sfdx-lwc-jest is already installed in your project. Here you build the test skeleton that ever3 min read@wire and Apex imports work, Jest basics (describe, it, expect, jest.fn), and promises with async/await.3 min readdescribe, it and expect. It also assumes you understand promises and async/await, and that you know how a component is created with createElement and attached to the DOM.2 min read@wire and imported Apex methods, and can read Jest tests and async/await.3 min read@wire, and that you know Jest's describe, it, expect, and async/await. It also assumes you know how to create a component with createElement, which an earlier chapter covered.2 min readcreateElement attaches a component to the DOM, and have used @wire with getRecord. The goal is to drive a component that reads a record through a built-in adapter, with no org and no server.2 min readcreateElement, how @wire delivers data to a component, and how to import an Apex method in LWC. It also assumes basic Jest (describe, it, expect, jest.fn) and async/await.2 min readdescribe, it, expect and jest.fn, and are comfortable with promises and async/await. It also assumes you have already created a component with createElement and flushed promises, as covered in earlier2 min readcreateElement, and that you know @wire, imported Apex methods, and async/await. The earlier chapters showed the success path. Here you cover the two other outcomes a data source can produce: an error and an empty result.3 min reademit, mockResolvedValue, and mockRejectedValue. Those pieces check what the component shows. Here you check what the component sends: the arguments passed to Apex and the configuration pas2 min readcreateElement, and that you know how to mock an imperative Apex import with jest.fn(). It also assumes you have seen test wire adapters and emit.2 min read@wire, importing Apex, Jest's describe, it, expect and jest.fn, and async/await. It collects the mistakes that most often break tests for wired and Apex-driven components, and shows how to find each one.2 min read