using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const greet = () => console.log('hello world'); | |
module.exports.greet = greet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prone to bugs! This is for learning and demonstration purposes only | |
let prev = 0, curr = 1; | |
// the generator | |
function* fibGen(n) { | |
const pos = 1; | |
for(let i=pos; i < n; ++i) { | |
[prev, curr] = yield asyncFetchPrevAndCurrValues(n); // returns a promise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Alice Doe", | |
"origin": "Kampala", | |
"destination": "New york", | |
"gender": "Male", | |
"manager": "John Mutuma", | |
"department": "TDD", | |
"role": "Senior Consultant", | |
"status": "Open", | |
"departureDate": "2018-08-16", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "John Doe", | |
"origin": "Kampala", | |
"destination": "New york", | |
"gender": "Male", | |
"manager": "Alice Doe", | |
"department": "TDD", | |
"role": "Senior Consultant", | |
"tripType": "multi", | |
"trips": [ |