Implement a magical vending machine.
No static calls to methods
No real implementations in unit Remtests other than the class you’re testing
Do not change files with // DO NOT MODIFY
on first line
Do not change signature of:
- MagicVendingMachine.insert(...)
- MagicVendingMachine.requestProduct(...)
- MagicVendingMachine.requestChange(...)
Get all tests in test/acceptance/acceptance-test.js
to pass.
Change it.skip(...
to it(...
to un-ignore a test. http://mochajs.org/#inclusive-tests
However feel free to take it as far as you like.
- Primitive Obsession - No strings, numbers, booleans, nulls or undefined (or arrays of these) in or returned from public interfaces
- ES6 - Use the most ES6 features.
Install dependencies
npm install
Run tests
npm test
The test framework is mocha and the assertion library is chai, sinon and sinon-chai have also been included for you. There is a helper.js file that includes mocha, chai, sinon and sinon-chai and sets up chai with the should style of assertions to save you having to do it in each test file.
There should be some runnable configs for mocha in intellij. The project was created using IntelliJ 14 so it may or may not work for you. If you'd like to create your own mocha configs:
Extra Mocha Options: "test/**/*-test.js" --compilers js:babel/register --require "test/helpers/helper.js"
Extra Mocha Options: "test/unit/**/*-test.js" --compilers js:babel/register --require "test/helpers/helper.js"
Extra Mocha Options: "test/acceptance/**/*-test.js" --compilers js:babel/register --require "test/helpers/helper.js"
http://ricostacruz.com/cheatsheets/chai.html
http://ricostacruz.com/cheatsheets/sinon-chai.html