The goal of this homework is to get you comfortable with writing and implementing prototypes and constructors. It will also introduce testing.
- Fork the repository
- Clone and
cd
into the car_lab folder - run
npm install
- run
npm test
-
Read the output to the terminal carefully!
-
Open the folder in sublime and navigate to /spec/test.js and /src/car.js.
-
Write code in car.js to make any failing tests pass.
-
Once all tests are either passed or pending, go into test.js and search the file for the first instance of "xit". Delete the "x" (change "xit" to "it") and run
npm test
again. Repeat until all 14 tests pass!
Write tests for parking the car then make them pass. (Hint: What happens to the state of the car when you park? What usually happens to passengers when a car is parked?)