Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Example Test
var Example = (function(){
return {
math: function() {
complexMethod: function() {
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
Something went wrong with that request. Please try again.