From 1d4722962471dec9d2a9d5edf8cd1e1a7b3e866a Mon Sep 17 00:00:00 2001 From: loicsaintroch Date: Thu, 22 Oct 2015 14:43:02 +0200 Subject: [PATCH] Fix tests witht latest dependencies updates --- test/middlewares/send/index.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/test/middlewares/send/index.js b/test/middlewares/send/index.js index 6abbc533b1..a78cfbbc52 100755 --- a/test/middlewares/send/index.js +++ b/test/middlewares/send/index.js @@ -179,7 +179,7 @@ describe('send', function () { app.use(function * () { const opts = { - root: 'test/fixtures' + root: 'test/middlewares/send/fixtures' }; yield strapi.middlewares.send(this, '../../../../test/middlewares/send/fixtures/world/index.html', opts); @@ -280,7 +280,8 @@ describe('send', function () { app.use(function * () { const opts = { root: 'test', - index: 'index.html' + index: 'index.html', + format: false }; yield strapi.middlewares.send(this, 'middlewares/send/fixtures/world', opts); @@ -328,6 +329,22 @@ describe('send', function () { .get('/') .expect(200, done); }); + + it('should 404 if no index', function (done) { + const app = new Koa(); + + app.use(function * () { + const opts = { + root: 'test' + }; + + yield strapi.middlewares.send(this, 'middlewares/send/fixtures/world', opts); + }); + + request(app.listen()) + .get('/') + .expect(404, done); + }); }); describe('when path is malformed', function () { @@ -386,7 +403,7 @@ describe('send', function () { request(app.listen()) .get('/') .set('Accept-Encoding', 'gzip, deflate, identity') - .expect('Content-Length', 48) + .expect('Content-Length', 18) .expect('{ "name": "tobi" }') .expect(200, done); }); @@ -403,7 +420,7 @@ describe('send', function () { request(app.listen()) .get('/') .set('Accept-Encoding', 'gzip, deflate, identity') - .expect('Content-Length', 48) + .expect('Content-Length', 18) .expect('{ "name": "tobi" }') .expect(200, done); });