Writing tests for a YouTubeSearchApp

In this section, we will explore how to write a complete unit test suite for the YouTubeSearchApp that we created in Chapter 8Debugging Lightning Components (see https://github.com/PacktPublishing/Learning-Salesforce-Lightning-Application-Development/tree/master/chapter8).

To create a scratch Org with the code samples, go through the following commands in your DX project:

$ git clone https://github.com/PacktPublishing/Learning-Salesforce-Lightning-Application-Development.git  //clone the repo

$ cd Chapter8 //cd into the chapter8 folder

$ sfdx force:auth:web:login -d -a DevHub //auth into Dev Hub

$ sfdx force:config:set defaultdevhubusername=DevHub // Set as default

$ sfdx force:org:create -s -f config/project-scratch-def.json -a testOrg // Create a scratch Org

$ sfdx force:config:set defaultusername=testOrg //set default scratch org

$ sfdx force:source:push // push source code

$ sfdx force:org:open //open scratch Org