-
-
Save arun12209/f64fec12ffa3282c50ce99e7b006060d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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