To use DOM Testing Library with Svelte, we’ll write a custom render function that utilizes the getQueriesForElement function. We’ll take the svelte template and create a constructor for that as well as the data to interpolate. Then we can use dom-testing-library queries as normal.
If you like this, checkout Svelte Testing Library.