9
Extracting Logic Out of the Framework
An important property of maintainable software is its testability. This is the idea that all parts of the application should be straightforward to test. More specifically, the design of the application code should make it easy to write automated unit tests.
In this chapter, we’ll look at one technique for improving testability: moving domain logic out of the framework and into plain JavaScript. Plain JavaScript code is simpler to test because there are no complex framework objects that interact with your code.
The following diagram shows how to think about a SvelteKit code base in this way.
Figure 9.1 ...
Get Svelte with Test-Driven Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.