Skip to content

Commit

Permalink
Add default values and validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tusbar committed Jul 30, 2015
1 parent a163060 commit 64e30b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/millipede.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ var millipede = require('../lib');
// ## //

describe('millipede', function () {
describe('default values', function () {
it('should default to 20 if the size is undefined', function () {
expect(millipede().size).to.equal(20);
});

it('should not be reversed by default', function () {
expect(millipede().reverse).to.be.false;
});
});

describe('validation', function () {
it('should throw if the size is too great', function () {
var run = function () { millipede(100001); };

expect(run).to.throw(millipede.MillipedeValidationError);
});
});

describe('render', function () {
it('should render a millipede of size 1', function () {
expect(millipede(1).toString()).to.equal([
Expand Down

0 comments on commit 64e30b0

Please sign in to comment.