Skip to content

Commit

Permalink
Fix tests witht latest dependencies updates
Browse files Browse the repository at this point in the history
  • Loading branch information
loicsaintroch committed Oct 22, 2015
1 parent 5734e91 commit 1d47229
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions test/middlewares/send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down

0 comments on commit 1d47229

Please sign in to comment.