Skip to content

Instantly share code, notes, and snippets.

@color2life
Last active August 29, 2015 14:04
Show Gist options
  • Save color2life/b2ca861bcd3e8128ae80 to your computer and use it in GitHub Desktop.
Save color2life/b2ca861bcd3e8128ae80 to your computer and use it in GitHub Desktop.
'use strict';
var TestSuite = {
module: function(name, testCases) {
this.result('<b><br/>Module: ' + name + ' testing</b>');
testCases(TestSuite);
},
test: function(name, testCase) {
this.result('Test: ' + name);
testCase(TestSuite.assert);
},
before: function(hook) {
this.result('before Run');
hook();
},
assert: {
equals: function(a, b, c) {
c = c || '';
if (a === b) {
return TestSuite.result('Equal '+ c);
}
},
notEquals: function(a, b, c) {
c = c || '';
if (a !== b) {
return TestSuite.result('Not equal '+ c);
}
}
},
result: function (results) {
var doc = document;
var resultDiv = doc.getElementById('results');
var testResults = doc.createElement('div');
testResults.innerHTML = results;
resultDiv.appendChild(testResults);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment