Fix tests witht latest dependencies updates

This commit is contained in:
loicsaintroch 2015-10-22 14:43:02 +02:00
parent 5734e91a91
commit 1d47229624

View File

@ -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);
});