Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 16, 2023 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/f64fec12ffa3282c50ce99e7b006060d to your computer and use it in GitHub Desktop.
Save arun12209/f64fec12ffa3282c50ce99e7b006060d to your computer and use it in GitHub Desktop.
import { createElement } from 'lwc';
import HelloWorld from 'c/helloWorld';
describe('c-hello-world', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});
it('displays the correct message', () => {
// Create element
const element = createElement('c-hello-world', {
is: HelloWorld
});
document.body.appendChild(element);
// Get message from component
const message = element.shadowRoot.querySelector('p');
expect(message.textContent).toBe('Hello, World!');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment