Tests often need to create "secondary" objects. For example, we might need to create a user before we can create a subscription for them. However, creating these objects directly in the test causes problems. We might have 1,000 tests that need a user to exist. If each of them directly creates the user, then changes to the user class will break every test. In this screencast, we see a way to write tests without coupling to these irrelevant details of other objects.
Execute Program
Looking for something more interactive? Try Execute Program, an interactive learning platform from Destroy All Software LLC! It has courses on TypeScript, SQL, regular expressions, JavaScript concurrency, and more. All Destroy All Software subscriptions include full access to Execute Program, or you can subscribe to Execute Program directly.