Skip to content

Instantly share code, notes, and snippets.

JohnM johnmutuma5

Block or report user

Report or block johnmutuma5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johnmutuma5
johnmutuma5 / ultimate-ut-cheat-sheet.md
Created Dec 7, 2018 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon
View ultimate-ut-cheat-sheet.md

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


View sample-request-data.json
{
"name": "John Doe",
"origin": "Kampala",
"destination": "New york",
"gender": "Male",
"manager": "Alice Doe",
"department": "TDD",
"role": "Senior Consultant",
"tripType": "multi",
"trips": [
View testRequest.json
{
"name": "Alice Doe",
"origin": "Kampala",
"destination": "New york",
"gender": "Male",
"manager": "John Mutuma",
"department": "TDD",
"role": "Senior Consultant",
"status": "Open",
"departureDate": "2018-08-16",
View generators with async calls.js
// 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
View hello.js
const greet = () => console.log('hello world');
module.exports.greet = greet;
You can’t perform that action at this time.