Created
May 11, 2012 20:46
-
-
Save fivetanley/2662314 to your computer and use it in GitHub Desktop.
Mocha test
This file contains hidden or 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
if (typeof define !== 'function'){ | |
var define = require('amdefine')(module); | |
} | |
define(['../lib/models/User'], function(User){ | |
'use strict'; | |
var given = describe; | |
describe('User', function(){ | |
var user; | |
beforeEach(function(){ | |
user = new User(); | |
}); | |
describe('id', function(){ | |
var id; | |
beforeEach(function(){ | |
id = user.get('id'); | |
}); | |
it('is a number', function(){ | |
id.should.be.a('number'); | |
}); | |
}); | |
describe('name', function(){ | |
var name; | |
beforeEach(function(){ | |
name = user.get('name'); | |
}); | |
it('is a property', function(){ | |
name.should.be.a('string'); | |
}); | |
it('is empty by default', function(){ | |
name.should.have.lengthOf(0); | |
}); | |
}); | |
describe('email', function(){ | |
var email; | |
beforeEach(function (){ | |
email = user.get('email'); | |
}); | |
it ('is a property of User', function(){ | |
email.should.be.a('string'); | |
}); | |
it('is empty by default', function(){ | |
email.should.have.lengthOf(0); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment