Lightning Web Components Tests Badge

Lightning Web Components Tests 

Unit 1: Get Started with Testing 

  1. What are the main differences between unit and end-to-end testing?
    1. Unit tests are not as fast as end-to-end tests.
    2. End-to-end tests don’t typically cover the entire application.
    3. End-to-end tests never use the browser.
    4. Unit tests are small and discrete where end-to-end tests cover the whole user experience.
    5. Unit tests tend to be large and cover all aspects of the application.
  1. Which are the main benefits of unit testing?
    1. They are fast, precise, and simulate a real user experience.
    2. They are fast, precise, and reliable.
    3. They cover many features in one test.
    4. They cover many features and simulate a real user experience.
    5. They test how everything works together.
Unit 2: Set Up Jest Testing Framework

  1. Which of the following best describes Jest?
    1. Jest is a JavaScript engine that runs in the browser to allow for testing. 
    2. Jest is a powerful package manager for reusable test modules.
    3. Jest is a powerful tool with rich features for writing JavaScript tests.
    4. Jest is a great Lightning Web Component for helping to troubleshoot apps.
  1. Why is Node.js important for Lightning Web Component tests?
    1. Jest tests don’t run in a browser and use Node’s JavaScript runtime to execute.
    2. Node.js is how you load Jest into your Salesforce org.
    3. @salesforce/sfdx-lwc-jest is a Node module that runs Jest tests for Lightning Web Components.
    4. A & C
    5. A & B
Unit 3: Write a Jest Test
  1. What is the describe block used for in Jest?
    1. The describe block is a Jest test suite that only allows for one test suite per block.
    2. The describe block is used to load the test from the Jest framework.
    3. The describe block is used to clean up the jsdom after each test.
    4. The describe block is a Jest test suite and allows for multiple test suites to be nested.
  1. Which lifecycle hook fires when a component is inserted into the DOM?
    1. insertedCall()
    2. connectedCallback()
    3. disconnectedCallback()
    4. connectedCall()
Unit 4: Write a Jest Test for Wire Service
  1. What are the three primary wire services adapters?
    1. Lightning Data Service, Generic, and Apex wire adapters
    2. Lightning Data Service, Apex, and Aura Component wire adapters
    3. Generic, Lightning Web Component, and Apex wire adapters
    4. Generic, Lightning Web Component, and Aura Component Apex wire adapters
  1. Which of the options below describes the best reason for mocking data for testing?
    1. It allows creating any data you like to get your test to pass.
    2. It allows slowing the tests down to allow for slow response times.
    3. It’s a great way to be sure the data is clean and prepped.
    4. It ensures tests aren’t dependent on unpredictable factors like remote invocation or server latency.
Unit 5: Mock Other Components
  1. How does sfdx-lwc-jest allow for Jest testing of Lightning Base Components?
    1. It includes a set of stubs for all components in the Aura namespace.
    2. It includes a set of stubs for all components in the lightning namespace.
    3. It includes a set of stubs for all components in the Aura and Lightning namespace.
    4. It gives Jest access to the org you are testing to build out Aura stubs.
    5. It gives Jest access to the org you are testing to build out Lightning stubs.
  1. What files are necessary to stub a component?
    1. Stubs need at least an HTML and a JavaScript file.
    2. Stubs need at least an HTML, JavaScript, and meta-data file.
    3. Stubs only require a JavaScript and meta-data file.
    4. Stubs only require a meta-data file.

Comments

Popular posts from this blog

Service Cloud for Lightning Experience - All Steps Q&A [Salesforce][Trailhead]

Salesforce Process Builder in Brief (Learning/Interview)

Cloud Computing

Copado Winter 21 Administrator Maintenance Dumps

Einstein Analytics Data Preparation Specialist