Lightning Web Components Tests Badge
Lightning Web Components Tests
Unit 1: Get Started with Testing
- What are the main differences between unit and end-to-end testing?
- Unit tests are not as fast as end-to-end tests.
- End-to-end tests don’t typically cover the entire application.
- End-to-end tests never use the browser.
- Unit tests are small and discrete where end-to-end tests cover the whole user experience.
- Unit tests tend to be large and cover all aspects of the application.
- Which are the main benefits of unit testing?
- They are fast, precise, and simulate a real user experience.
- They are fast, precise, and reliable.
- They cover many features in one test.
- They cover many features and simulate a real user experience.
- They test how everything works together.
Unit 2: Set Up Jest Testing Framework
- Which of the following best describes Jest?
- Jest is a JavaScript engine that runs in the browser to allow for testing.
- Jest is a powerful package manager for reusable test modules.
- Jest is a powerful tool with rich features for writing JavaScript tests.
- Jest is a great Lightning Web Component for helping to troubleshoot apps.
- Why is Node.js important for Lightning Web Component tests?
- Jest tests don’t run in a browser and use Node’s JavaScript runtime to execute.
- Node.js is how you load Jest into your Salesforce org.
- @salesforce/sfdx-lwc-jest is a Node module that runs Jest tests for Lightning Web Components.
- A & C
- A & B
- What is the describe block used for in Jest?
- The describe block is a Jest test suite that only allows for one test suite per block.
- The describe block is used to load the test from the Jest framework.
- The describe block is used to clean up the jsdom after each test.
- The describe block is a Jest test suite and allows for multiple test suites to be nested.
- Which lifecycle hook fires when a component is inserted into the DOM?
- insertedCall()
- connectedCallback()
- disconnectedCallback()
- connectedCall()
- What are the three primary wire services adapters?
- Lightning Data Service, Generic, and Apex wire adapters
- Lightning Data Service, Apex, and Aura Component wire adapters
- Generic, Lightning Web Component, and Apex wire adapters
- Generic, Lightning Web Component, and Aura Component Apex wire adapters
- Which of the options below describes the best reason for mocking data for testing?
- It allows creating any data you like to get your test to pass.
- It allows slowing the tests down to allow for slow response times.
- It’s a great way to be sure the data is clean and prepped.
- It ensures tests aren’t dependent on unpredictable factors like remote invocation or server latency.
- How does sfdx-lwc-jest allow for Jest testing of Lightning Base Components?
- It includes a set of stubs for all components in the Aura namespace.
- It includes a set of stubs for all components in the lightning namespace.
- It includes a set of stubs for all components in the Aura and Lightning namespace.
- It gives Jest access to the org you are testing to build out Aura stubs.
- It gives Jest access to the org you are testing to build out Lightning stubs.
- What files are necessary to stub a component?
- Stubs need at least an HTML and a JavaScript file.
- Stubs need at least an HTML, JavaScript, and meta-data file.
- Stubs only require a JavaScript and meta-data file.
- Stubs only require a meta-data file.
Comments
Post a Comment