This was created during my time as a Code Chrysalis Student
You are hired by Studio Ghibli to help fix their test suite.
They have a large database of movies and characters, and they wrote a program to query it for various information.
Luckily they have also written tests! Unfortunately, the test suite has become terribly so, because they only test for state, and not behavior, and because they read the entire database from disk for each test.
Your mission (and you must choose to accept it), is to refactor their tests to use sinon to replace all file system access with test doubles during the test.
Refactor their tests from TDD to BDD:
- Select mocks, stubs, or spies as appropriate for each test
- Use test doubles to prevent any real disk access from occurring
- Set up the minimal state necessary in your test! Don't stub the whole file!
- Use test values that are easy to reason about
- Read When to use mocks, stubs, and spies in Sinon
- Be sure to read the documentation on stubs