This project involves reimplementing a range of functions from the Underscore library, using Test-Driven-Development to test the functionality of each of the functions.
The following functions have been implemented. Descriptions and examples of how each works can be found in the underscore library.
-
indexOf (implementing a binary search)
A seperate binarySearch file, which is imported into the main document, is contained in the lib file and tested seperately.
To run the test suite for this project, the following steps should be taken.
This project requires nodejs and npm to be installed.
If nodejs is not installed on your machine, refer to the node documentation for instructions.
To confirm you have npm installed on your machine, run the following code:
npm -v
If you don't have npm installed on your machine, instructions for installing npm can be found at [https://www.npmjs.com/get-npm].
Each function is tested with a series of tests, which use the Mocha test framework alongside the Chai assertion library. Istanbul NYC is used to provide code coverage tests. Sinon spy is used in some tests. To run the tests, please follow the following instructions.
- Download dependencies
Ensure the dependencies are installed locally, by running npm install
npm install
- Run the test suite
npm test
All dependencies are development dependencies, used in the test suite.
Sally Newell salvn
Inspired by Underscore js and completed as part of a project at Northcoders