You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use this module but I'm having a hard time figuring out if it's possible to set default expectations. Specifically, I want all my calls to .expect('Content-Type', /json/) but, when I add that to the defaults I get:
/Users/lgomez/Projects/api/test/index.js:6
.expect('Content-Type', /json/);
^
TypeError: api.set(...).expect is not a function
at Object.<anonymous> (/Users/lgomez/Projects/api/test/index.js:6:4)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at /Users/lgomez/Projects/api/node_modules/mocha/lib/mocha.js:216:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/lgomez/Projects/api/node_modules/mocha/lib/mocha.js:213:14)
at Mocha.run (/Users/lgomez/Projects/api/node_modules/mocha/lib/mocha.js:453:10)
at Object.<anonymous> (/Users/lgomez/Projects/api/node_modules/mocha/bin/_mocha:393:18)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:138:18)
at node.js:974:3
This is how I'm running it:
vardefaults=require('superagent-defaults');varapi=defaults(require('supertest')(require('../server')));// ..server is an expressjs appapi.set('Accept','application/json').expect('Content-Type',/json/);describe('/users',function(){it('accepts email and password as auth payload',function(done){api.post('/users/auth').send({email: '[email protected]',}).expect(200,done);});});
The text was updated successfully, but these errors were encountered:
Hello,
I'd like to use this module but I'm having a hard time figuring out if it's possible to set default expectations. Specifically, I want all my calls to
.expect('Content-Type', /json/)
but, when I add that to the defaults I get:This is how I'm running it:
The text was updated successfully, but these errors were encountered: