Last active
August 29, 2015 14:03
-
-
Save heymichaelp/e29dad1f3f28db7d1870 to your computer and use it in GitHub Desktop.
Policy Objects: Example Unit Tests
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
var _ = require('underscore') | |
var expect = require('chai').expect; | |
var Policy = require('./Policy'); | |
describe('Policy', function(){ | |
it('returns true if the object passes the policy tests', function(){ | |
var student = { | |
firstName: 'John', | |
lastName: 'Smith', | |
isExpelled: false, | |
isSuspended: false | |
}; | |
var eligibility = new Policy(student).run(); | |
expect(eligibility).to.be.true; | |
}); | |
it('returns false if the student is expelled', function(){ | |
var expelledStudent = { | |
firstName: 'John', | |
lastName: 'Smith', | |
isExpelled: true, | |
isSuspended: false | |
}; | |
var eligibility = new Policy(expelledStudent).run(); | |
expect(eligibility).to.be.false; | |
}); | |
it('returns false if the student is suspended', function(){ | |
var suspendedStudent = { | |
firstName: 'John', | |
lastName: 'Smith', | |
isExpelled: false, | |
isSuspended: true | |
}; | |
var eligibility = new Policy(suspendedStudent).run(); | |
expect(eligibility).to.be.false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment