Skip to content

Instantly share code, notes, and snippets.

@kingcons
Created July 5, 2016 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingcons/db5e8ed22d3365a2b2eb5986db1fc4f4 to your computer and use it in GitHub Desktop.
Save kingcons/db5e8ed22d3365a2b2eb5986db1fc4f4 to your computer and use it in GitHub Desktop.
ye olde 20 line test lib
let it = function (description, contents) {
console.log('\n\n"It ' + description + '"');
contents();
};
let expect = function (target) {
return {
toBe: function(expectation) {
if (target === expectation) {
console.log('\n %cPASSED', 'color:green;', 'Expected', target, 'to be', expectation);
return true;
} else {
console.log('\n %cFAILED', 'color:red;', 'Expected', target, 'to be', expectation);
return false;
}
}
};
};
export {it, expect};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment