Skip to content

Commit 61a2b97

Browse files
committed
added test case
1 parent 548b83a commit 61a2b97

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ Now that your bundle.js file is included in the html , we can use the web compon
9292
## Test cases 📌
9393
Write test cases inside __tests __ folder
9494

95+
Note : Dont treat webcomponents as a special case for testing, they should be tested as normal svelte components.
96+
97+
```javascript
98+
import { render } from "@testing-library/svelte";
99+
import App from "../src/App.svelte";
100+
101+
describe("App component", () => {
102+
test("should render component correctly", () => {
103+
const { container } = render(App);
104+
105+
expect(container).toContainHTML("<body><div><h1>Hello from svelte</h1></div></body>");
106+
});
107+
});
108+
```
109+
110+
Use normal component name and not the webcomponent name in the test case.
111+
95112
```bash
96113
npm run test
97114
```

0 commit comments

Comments
 (0)