Implement a pure splice function using test-driven development.
(Needed for Part II)
- splice
- Jasmine (docs)
- How Do I Jasmine (tutorial)
- Unit Testing (Raine's Presentation)
-
Download or clone the test-drive-101 files from the exercise-starters repo.
-
Open test-runner.html in your browser. Open the dev tools console. See the errors that say FAIL? Congratulations, you're already through the "red" phase of test-drive development!
-
Open spec.js in your editor. Implement the splice method so the accompanying tests all pass.
Tip: Look over the included assertfunctions which serve as a barebones testing framework. Look over the unit tests at the end (where assert is called) to see the kinds of things that are being tested for. You will get to write your own unit tests soon!
- Read the [How Do I Jasmine](http://evanhahn.com/how-do-i-jasmine/) tutorial.
- Clone or download the [jasmine boilerplate](https://github.com/RefactorU/student-sample-code/tree/master/jasmine) from the student-sample-code repo. Save this into the local repo you will be submitting for this exercise.
- Copy your splice function into a new javascript file and modify SpecRunner.html to include it.
- Open SpecRunner.html in your browser to see the initial (failing) test suite being invoked.
- Rewrite the unit tests from Part I using [Jasmine](https://jasmine.github.io/)-style unit tests. Write these in spec/my-spec.js which is already being included by SpecRunner.html. Make sure that the tests all pass, and that they cover all the cases originally covered in Part I.
Warning: There are a lot of files being download, saved, and included in this exercise. If something fails to work or it seems like a file is not included correctly, use this opportunity to practice your debugging skills and see if you can trace the problem. What might be causing it? How can you test your assumptions? What basic functionality can you make sure is working?