Skip to content
Myr

tests: fixup new json tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 3d6b4ba · Browse files · 2 files+42 added−36 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+42 added−36 removed

  • tests:+42 added−36 removed

2 files+42 added−36 removed

modified:test/res.json.js+14 added-18 removed
modified:test/res.jsonp.js+28 added-18 removed
117 unmodified lines
118 done();119 });120 });121122 it('should not override previous Content-Types with no callback', function(done){123 var app = express();124125 app.get('/', function(req, res){126 res.type('application/vnd.example+json');127 res.jsonp({ hello: 'world' });128 });129130 request(app)131 .get('/')132 .expect('Content-Type', 'application/vnd.example+json')133 .expect(200, '{"hello":"world"}', done);134 })135136 it('should override previous Content-Types with callback', function(done){137 var app = express();138139 app.get('/', function(req, res){140 res.type('application/vnd.example+json');141 res.jsonp({ hello: 'world' });142 });143144 request(app)145 .get('/?callback=cb')146 .expect('Content-Type', 'text/javascript; charset=utf-8')147 .expect(200, /cb\(\{"hello":"world"\}\);$/, done);148 })149150 describe('when given primitives', function(){151 it('should respond with json', function(done){152 var app = express();153
131 unmodified lines
285 done();286 })287 })288 })261262 it('should not override previous Content-Types', function(done){263 var app = express();264265 app.get('/', function(req, res){266 res.type('application/vnd.example+json');267 res.jsonp({ hello: 'world' });268 });269270 request(app)271 .get('/')272 .end(function(err, res){273 res.statusCode.should.equal(200);274 res.headers.should.have.property('content-type', 'application/vnd.example+json');275 res.text.should.equal('{"hello":"world"}');276 done();277 })278 })289})