Summary
We've finished the book by looking at how even a complex browser feature, such as service workers, can be fully covered by tests.
You’ve seen how Playwright tests should always test the benefit provided by the implementation – in this case, checking that the page is available offline – rather than testing an implementation detail, such as whether the service worker is is available or not.
You’ve also seen how the Vitest tests can avoid checking the awkward service worker interface by pushing the majority of the implementation into plain JavaScript functions.
And with that, our tour of test-driven Svelte comes to an end. It’s now over to you to put what you’ve learned into practice.
As this book has shown, there are many avenues that your testing practice can follow. I encourage you to experiment and find what works for you. Seek out the practices that make your life easier and allow you to build higher-quality software...