Example Test
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
var Example = (function(){ | |
return { | |
math: function() { | |
}, | |
complexMethod: function() { | |
} | |
} | |
}()); |
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
requireApp('example/js/example.js'); | |
suite('Example', function() { | |
var subject; | |
//will be called before each "test" block. | |
setup(function() { | |
subject = new Example(); | |
}); | |
//for a simple method | |
test('#math', function() { | |
var result = subject.math('1', '+', '1'); | |
assert.equal(result, 2, 'addition should work'); | |
}); | |
//when you have a method that will | |
//require complex setup/teardown logic | |
suite('#complexMethod', function() { | |
var result; | |
setup(function() { | |
//complex setup stuff | |
result = subject.complexMethod(); | |
}); | |
test('stuff works', function() { | |
assert.equal(result, 'real value', 'should output real value'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment