Reader small image

You're reading from  Salesforce Lightning Platform Enterprise Architecture - Third Edition

Product typeBook
Published inNov 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789956719
Edition3rd Edition
Languages
Concepts
Right arrow
Author (1)
Andrew Fawcett
Andrew Fawcett
author image
Andrew Fawcett

Andrew Fawcett has over 30 years of experience holding several software development-related roles with a focus around enterprise-level product architecture. He is experienced in managing all aspects of the software development life cycle across various technology platforms, frameworks, industry design patterns, and methodologies. He is currently a VP, Product Management, and a Salesforce Certified Platform Developer II at Salesforce. He is responsible for several key platform features and emergent products for Salesforce. He is an avid blogger, open source contributor and project owner, and an experienced speaker. He loves watching movies, Formula 1 motor racing, and building Lego!
Read more about Andrew Fawcett

Right arrow

Unit testing with Lightning Web Components

In this section, we are going to build a unit test for the Race Setup Lightning Web Component. This component has a number of dependencies that need to be mocked in order to build a successful unit test that covers the component's HTML and JavaScript code. Here is a reminder of what the component looks like:

When the user selects drivers and clicks Add Drivers, a confirmation toast message is shown:

The Race Setup component uses a lightning-table child component defined in its HTML and methods from an Apex Controller RaceSetupComponentController class defined in its JavaScript controller. Lightning Web Components unit tests focus solely on the logic directly in the Race Setup component code (raceSetup.html and raceSetup.js) and no other concerns, thus, we will focus on testing the following behaviors:

  • When the component has...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Salesforce Lightning Platform Enterprise Architecture - Third Edition
Published in: Nov 2019Publisher: PacktISBN-13: 9781789956719

Author (1)

author image
Andrew Fawcett

Andrew Fawcett has over 30 years of experience holding several software development-related roles with a focus around enterprise-level product architecture. He is experienced in managing all aspects of the software development life cycle across various technology platforms, frameworks, industry design patterns, and methodologies. He is currently a VP, Product Management, and a Salesforce Certified Platform Developer II at Salesforce. He is responsible for several key platform features and emergent products for Salesforce. He is an avid blogger, open source contributor and project owner, and an experienced speaker. He loves watching movies, Formula 1 motor racing, and building Lego!
Read more about Andrew Fawcett