-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from esco/master
kick off testing with test for hasNextPages
- Loading branch information
Showing
5 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var paginate = require('../index'); | ||
|
||
describe('paginate', function(){ | ||
|
||
describe('.hasNextPages(req)', function(){ | ||
|
||
beforeEach(function(){ | ||
this.req = {query:{page:3}}; | ||
}); | ||
|
||
it('should return function', function(){ | ||
paginate.hasNextPages(this.req).should.be.a('function'); | ||
}); | ||
|
||
describe('the returned function', function(){ | ||
|
||
it('should return true when there are more pages', function(){ | ||
paginate.hasNextPages(this.req)(4).should.be.true; | ||
}); | ||
|
||
it('should return false when there are no more pages', function(){ | ||
paginate.hasNextPages(this.req)(3).should.be.false; | ||
}); | ||
|
||
it('should throw an error when pageCount is not a number', function(){ | ||
(function(){ | ||
paginate.hasNextPages(this.req)(''); | ||
}).should.throw(/not a number/); | ||
}); | ||
|
||
it('should throw an error when pageCount is less than zero', function(){ | ||
(function(){ | ||
paginate.hasNextPages(this.req)(''); | ||
}).should.throw(/\> 0/); | ||
}); | ||
|
||
}) | ||
|
||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var chai = require('chai'); | ||
chai.should(); |