Fixtures are the part of a test suite that set the stage for our specs. In this video, we’ll write code to run before every spec and also before each test spec that makes testing simpler.
- Mocha provides useful functions to help us set up conditions for our tests, like creating test objects and simulating the conditions inside our app
- The "setup" phase is the part of our tests where we set up conditions for testing
- Mocha splits the setup process into two blocks: the stuff we set up before the entire series of tests, and the stuff we set up before each individual test
- Mocha provides the hooks
afterEach()to set up preconditions and clean up after your tests
beforeEach()works like before, only it will run the function before each spec, instead of just once at the start of the suite
You need to sign up for Treehouse in order to download course files.Sign up