Salesforce
PDII · Question #360
A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections. What should the developer do to properly test…
The correct answer is C. Create a new describe block for each test. See the full explanation below for the reasoning.
Question
A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections. What should the developer do to properly test that the correct components display and hide for each scenario?
Options
- AAdd a teardown block to reset the DOM after each test.
- BCreate a new jsdom instance for each test.
- CCreate a new describe block for each test.
- DReset the DOM after each test with the afterEach() method.
How the community answered
(39 responses)- A15% (6)
- B5% (2)
- C72% (28)
- D8% (3)
Community Discussion
No community discussion yet for this question.