Commit feb6647c by Ben Drucker

Test a 202 response

parent b53855d7
...@@ -31,8 +31,9 @@ describe('Person', function () { ...@@ -31,8 +31,9 @@ describe('Person', function () {
describe('Person#find', function () { describe('Person#find', function () {
var alex = require('./fixtures/person');
it('can find a person by email', function () { it('can find a person by email', function () {
var alex = require('./fixtures/person');
mock mock
.get('/v1/people/email/alex@alexmaccaw.com') .get('/v1/people/email/alex@alexmaccaw.com')
.reply(200, alex); .reply(200, alex);
...@@ -47,17 +48,27 @@ describe('Person', function () { ...@@ -47,17 +48,27 @@ describe('Person', function () {
it('can subscribe to a person', function () { it('can subscribe to a person', function () {
mock mock
.get('/v1/people/email/alex@alexmaccaw.com?subscribe=true') .get('/v1/people/email/alex@alexmaccaw.com?subscribe=true')
.reply(200); .reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com', subscribe: true}); return Person.find({email: 'alex@alexmaccaw.com', subscribe: true});
}); });
it('can override the company setting', function () { it('can override the company setting', function () {
mock mock
.get('/v1/people/email/alex@alexmaccaw.com?company=false') .get('/v1/people/email/alex@alexmaccaw.com?company=false')
.reply(200); .reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com', company: false}); return Person.find({email: 'alex@alexmaccaw.com', company: false});
}); });
it('is can handle pending requests', function () {
mock
.get('/v1/people/email/alex@alexmaccaw.com')
.reply(202);
return Person.find({email: 'alex@alexmaccaw.com'})
.then(function (person) {
expect(person.pending()).to.be.true;
});
});
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment