Skip to content

Commit

Permalink
Add error tests for check list & retrieve
Browse files Browse the repository at this point in the history
Closes #73
  • Loading branch information
Grayson Chao committed Sep 17, 2014
1 parent efb8599 commit 8ecdcc5
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions test/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Checks', function () {
});
});
});
describe('get', function () {
describe('retrieve', function () {
it('should succeed on get', function (done) {
Lob.checks.create({
name: 'TEST_CHECK',
Expand All @@ -125,19 +125,27 @@ describe('Checks', function () {
memo: 'test check'
}, function (err, res) {
var id = res.id;
Lob.checks.retrieve(id,function (err, res) {
Lob.checks.retrieve(id, function (err, res) {
expect(res).to.have.property('id');
expect(res).to.have.property('name');
expect(res).to.have.property('bank_account');
expect(res).to.have.property('check_number');
expect(res).to.have.property('memo');
expect(res.memo).to.eql('test check');
expect(res.object).to.eql('check');
return done();
done();
});
});
});

it('should fail with invalid id', function (done) {
Lob.checks.retrieve('BADCHECKID', function (err) {
expect(err).to.not.eql(null);
done();
});
});
});

describe('list', function () {
it('should have correct defaults', function (done) {
Lob.checks.list(function (err, res) {
Expand All @@ -155,6 +163,7 @@ describe('Checks', function () {
return done();
});
});

it('should override count', function (done) {
Lob.checks.list({count: 5, offset: 0}, function (err, res) {
expect(res).to.have.property('object');
Expand All @@ -171,6 +180,7 @@ describe('Checks', function () {
done();
});
});

it('should override count', function (done) {
Lob.checks.list({offset: 0}, function (err, res) {
expect(res).to.have.property('object');
Expand All @@ -187,6 +197,13 @@ describe('Checks', function () {
done();
});
});

it('should error with count>100', function (done) {
Lob.checks.list({count: 9001}, function (err) {
expect(err).to.not.eql(null);
done();
});
});
});
});
/* jshint camelcase: true */

0 comments on commit 8ecdcc5

Please sign in to comment.