Fix indentation and add .eslint rules

closes #555
This commit is contained in:
Slobodan Stojanovic 2015-10-28 08:53:49 +01:00 committed by jongleberry
parent 6d3b81fe50
commit b08facb7bd
16 changed files with 318 additions and 319 deletions

View file

@ -11,3 +11,4 @@ rules:
yoda: 0
arrow-parens: [2, "as-needed"]
arrow-spacing: 2
dot-location: [2, "property"]

View file

@ -92,9 +92,7 @@ module.exports = class Application extends Emitter {
use(fn) {
debug('use %s', fn._name || fn.name || '-');
if (typeof fn !== 'function') throw new TypeError('middleware must be a function!');
if (isGeneratorFunction(fn)) {
throw new TypeError('Support for generators has been removed. Use Promises or wrap your generator with co.wrap');
}
if (isGeneratorFunction(fn)) throw new TypeError('Support for generators has been removed. Use Promises or wrap your generator with co.wrap');
this.middleware.push(fn);
return this;
}

View file

@ -81,9 +81,7 @@ module.exports = {
get href() {
// support: `GET http://example.com/foo`
if (/^https?:\/\//i.test(this.originalUrl)) {
return this.originalUrl;
}
if (/^https?:\/\//i.test(this.originalUrl)) return this.originalUrl;
return this.origin + this.originalUrl;
},
@ -400,12 +398,13 @@ module.exports = {
/**
* Return subdomains as an array.
*
* Subdomains are the dot-separated parts of the host before the main domain of
* the app. By default, the domain of the app is assumed to be the last two
* Subdomains are the dot-separated parts of the host before the main domain
* of the app. By default, the domain of the app is assumed to be the last two
* parts of the host. This can be changed by setting `app.subdomainOffset`.
*
* For example, if the domain is "tobi.ferrets.example.com":
* If `app.subdomainOffset` is not set, this.subdomains is `["ferrets", "tobi"]`.
* If `app.subdomainOffset` is not set, this.subdomains is
* `["ferrets", "tobi"]`.
* If `app.subdomainOffset` is 3, this.subdomains is `["tobi"]`.
*
* @return {Array}

View file

@ -446,9 +446,11 @@ module.exports = {
*
* Examples:
*
* this.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);
* this.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly');
* this.append('Warning', '199 Miscellaneous warning');
* ```
* this.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);
* this.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly');
* this.append('Warning', '199 Miscellaneous warning');
* ```
*
* @param {String} field
* @param {String|Array} val

View file

@ -17,8 +17,8 @@ describe('app.context', function(){
});
request(app1.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
it('should not affect the original prototype', function(done){
@ -28,7 +28,7 @@ describe('app.context', function(){
});
request(app2.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
});

View file

@ -20,8 +20,8 @@ describe('app', function(){
});
request(app.listen())
.get('/')
.end(function(){});
.get('/')
.end(function(){});
});
it('should not .writeHead when !socket.writable', function(done){
@ -42,8 +42,8 @@ describe('app', function(){
setImmediate(done);
request(app.listen())
.get('/')
.end(function(){});
.get('/')
.end(function(){});
});
it('should set development env when NODE_ENV missing', function(){

View file

@ -17,8 +17,8 @@ describe('app.request', function(){
});
request(app1.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
it('should not affect the original prototype', function(done){
@ -28,7 +28,7 @@ describe('app.request', function(){
});
request(app2.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
});

View file

@ -27,10 +27,10 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200)
.expect('lol')
.end(done);
.get('/')
.expect(200)
.expect('lol')
.end(done);
});
});
@ -67,15 +67,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'text/plain; charset=utf-8');
res.should.have.header('Content-Length', '5');
assert(0 == res.text.length);
done();
});
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'text/plain; charset=utf-8');
res.should.have.header('Content-Length', '5');
assert(0 == res.text.length);
done();
});
});
it('should keep json headers', function(done){
@ -88,15 +88,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'application/json; charset=utf-8');
res.should.have.header('Content-Length', '17');
assert(0 == res.text.length);
done();
});
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'application/json; charset=utf-8');
res.should.have.header('Content-Length', '17');
assert(0 == res.text.length);
done();
});
});
it('should keep string headers', function(done){
@ -109,15 +109,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'text/plain; charset=utf-8');
res.should.have.header('Content-Length', '11');
assert(0 == res.text.length);
done();
});
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'text/plain; charset=utf-8');
res.should.have.header('Content-Length', '11');
assert(0 == res.text.length);
done();
});
});
it('should keep buffer headers', function(done){
@ -130,15 +130,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'application/octet-stream');
res.should.have.header('Content-Length', '11');
assert(0 == res.text.length);
done();
});
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'application/octet-stream');
res.should.have.header('Content-Length', '11');
assert(0 == res.text.length);
done();
});
});
it('should respond with a 404 if no body was set', function(done){
@ -151,8 +151,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(404, done);
.head('/')
.expect(404, done);
});
it('should respond with a 200 if body = ""', function(done){
@ -165,8 +165,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect(200, done);
.head('/')
.expect(200, done);
});
it('should not overwrite the content-type', function(done){
@ -180,9 +180,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.head('/')
.expect('content-type', /application\/javascript/)
.expect(200, done);
.head('/')
.expect('content-type', /application\/javascript/)
.expect(200, done);
});
});
@ -193,8 +193,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(404, done);
.get('/')
.expect(404, done);
});
});
@ -217,13 +217,13 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
if (errorCaught) return done(errorCaught);
done();
});
.get('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
if (errorCaught) return done(errorCaught);
done();
});
});
it('should send the right body', function(done){
@ -242,9 +242,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200)
.expect('HelloGoodbye', done);
.get('/')
.expect(200)
.expect('HelloGoodbye', done);
});
});
@ -260,10 +260,10 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(400)
.expect('Content-Length', 11)
.expect('Bad Request', done);
.get('/')
.expect(400)
.expect('Content-Length', 11)
.expect('Bad Request', done);
});
});
@ -278,15 +278,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
});
@ -301,15 +301,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(205)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(205)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
});
@ -324,15 +324,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(304)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(304)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
});
@ -348,14 +348,14 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(700)
.expect('custom status')
.end(function(err, res){
if (err) return done(err);
res.res.statusMessage.should.equal('custom status');
done();
});
.get('/')
.expect(700)
.expect('custom status')
.end(function(err, res){
if (err) return done(err);
res.res.statusMessage.should.equal('custom status');
done();
});
});
});
@ -371,14 +371,14 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200)
.expect('ok')
.end(function(err, res){
if (err) return done(err);
res.res.statusMessage.should.equal('ok');
done();
});
.get('/')
.expect(200)
.expect('ok')
.end(function(err, res){
if (err) return done(err);
res.res.statusMessage.should.equal('ok');
done();
});
});
});
@ -393,9 +393,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(701)
.expect('701', done);
.get('/')
.expect(701)
.expect('701', done);
});
});
});
@ -411,15 +411,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
it('should respond 204 with status=200', function(done){
@ -433,15 +433,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(204)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
it('should respond 205 with status=205', function(done){
@ -455,15 +455,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(205)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(205)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
it('should respond 304 with status=304', function(done){
@ -477,15 +477,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(304)
.expect('')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(304)
.expect('')
.end(function(err, res){
if (err) return done(err);
res.header.should.not.have.property('content-type');
done();
});
res.header.should.not.have.property('content-type');
done();
});
});
});
@ -500,8 +500,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Hello', done);
.get('/')
.expect('Hello', done);
});
});
@ -516,8 +516,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Hello', done);
.get('/')
.expect('Hello', done);
});
});
@ -533,15 +533,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.not.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.not.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
});
it('should strip content-length when overwriting', function(done){
@ -556,15 +556,15 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.not.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.not.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
});
it('should keep content-length if not overwritten', function(done){
@ -579,42 +579,43 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
});
it('should keep content-length if overwritten with the same stream', function(done){
const app = new Koa();
it('should keep content-length if overwritten with the same stream',
done => {
const app = new Koa();
app.use(function(ctx){
ctx.length = fs.readFileSync('package.json').length;
const stream = fs.createReadStream('package.json');
ctx.body = stream;
ctx.body = stream;
ctx.set('Content-Type', 'application/json; charset=utf-8');
app.use(function(ctx){
ctx.length = fs.readFileSync('package.json').length;
const stream = fs.createReadStream('package.json');
ctx.body = stream;
ctx.body = stream;
ctx.set('Content-Type', 'application/json; charset=utf-8');
});
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
});
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res){
if (err) return done(err);
const pkg = require('../../package');
res.should.have.header('Content-Length');
res.body.should.eql(pkg);
done();
});
});
it('should handle errors', function(done){
const app = new Koa();
@ -626,10 +627,10 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect(404)
.end(done);
.get('/')
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect(404)
.end(done);
});
it('should handle errors when no content status', function(done){
@ -643,8 +644,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
it('should handle all intermediate stream body errors', function(done){
@ -659,8 +660,8 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(404, done);
.get('/')
.expect(404, done);
});
});
@ -675,9 +676,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect('{"hello":"world"}', done);
.get('/')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect('{"hello":"world"}', done);
});
});
@ -695,8 +696,8 @@ describe('app.respond', function(){
});
request(app.listen())
.get('/')
.end(function(){});
.get('/')
.end(function(){});
});
describe('with an .expose property', function(){
@ -711,9 +712,9 @@ describe('app.respond', function(){
});
request(app.listen())
.get('/')
.expect(403, 'sorry!')
.end(done);
.get('/')
.expect(403, 'sorry!')
.end(done);
});
});
@ -728,9 +729,9 @@ describe('app.respond', function(){
});
request(app.listen())
.get('/')
.expect(403, 'Forbidden')
.end(done);
.get('/')
.expect(403, 'Forbidden')
.end(done);
});
});
@ -744,9 +745,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(500, 'Internal Server Error')
.end(done);
.get('/')
.expect(500, 'Internal Server Error')
.end(done);
});
it('should be catchable', function(done){
@ -767,9 +768,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200, 'Got error')
.end(done);
.get('/')
.expect(200, 'Got error')
.end(done);
});
});
@ -786,9 +787,9 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(200)
.expect('hello', done);
.get('/')
.expect(200)
.expect('hello', done);
});
it('should 204', function(done){
@ -804,12 +805,12 @@ describe('app.respond', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.end(function(err, res){
res.should.not.have.header('content-type');
done(err);
});
.get('/')
.expect(204)
.end(function(err, res){
res.should.not.have.header('content-type');
done(err);
});
});
});
});

View file

@ -17,8 +17,8 @@ describe('app.response', function(){
});
request(app1.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
it('should not affect the original prototype', function(done){
@ -28,7 +28,7 @@ describe('app.response', function(){
});
request(app2.listen())
.get('/')
.expect(204, done);
.get('/')
.expect(204, done);
});
});

View file

@ -33,13 +33,13 @@ describe('app.use(fn)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(404)
.end(function(err){
if (err) return done(err);
calls.should.eql([1, 2, 3, 4, 5, 6]);
done();
});
.get('/')
.expect(404)
.end(function(err){
if (err) return done(err);
calls.should.eql([1, 2, 3, 4, 5, 6]);
done();
});
});
// https://github.com/koajs/koa/pull/530#issuecomment-148138051
@ -51,9 +51,9 @@ describe('app.use(fn)', function(){
});
request(app.listen())
.get('/')
.expect(404)
.end(done);
.get('/')
.expect(404)
.end(done);
});
it('should throw error for non function', function(done){

View file

@ -16,16 +16,15 @@ describe('ctx.cookies.set()', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(204)
.end(function(err, res){
if (err) return done(err);
res.headers['set-cookie'].some(cookie => /^name=/.test(cookie))
.should.be.ok;
res.headers['set-cookie'].some(cookie => /^name=/.test(cookie)).should.be.ok;
done();
});
done();
});
});
describe('with .signed', function(){
@ -42,8 +41,8 @@ describe('ctx.cookies.set()', function(){
});
request(app.listen())
.get('/')
.expect('.keys required for signed cookies', done);
.get('/')
.expect('.keys required for signed cookies', done);
});
});
@ -60,19 +59,19 @@ describe('ctx.cookies.set()', function(){
const server = app.listen();
request(server)
.get('/')
.expect(204)
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(204)
.end(function(err, res){
if (err) return done(err);
const cookies = res.headers['set-cookie'];
const cookies = res.headers['set-cookie'];
cookies.some(cookie => /^name=/.test(cookie)).should.be.ok;
cookies.some(cookie => /^name=/.test(cookie)).should.be.ok;
cookies.some(cookie => /^name\.sig=/.test(cookie)).should.be.ok;
cookies.some(cookie => /^name\.sig=/.test(cookie)).should.be.ok;
done();
});
done();
});
});
});
});

View file

@ -17,11 +17,11 @@ describe('ctx.onerror(err)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(418)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Content-Length', '4')
.end(done);
.get('/')
.expect(418)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Content-Length', '4')
.end(done);
});
it('should unset all headers', function(done){
@ -38,18 +38,18 @@ describe('ctx.onerror(err)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(418)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Content-Length', '4')
.end(function(err, res){
if (err) return done(err);
.get('/')
.expect(418)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Content-Length', '4')
.end(function(err, res){
if (err) return done(err);
res.headers.should.not.have.property('vary');
res.headers.should.not.have.property('x-csrf-token');
res.headers.should.not.have.property('vary');
res.headers.should.not.have.property('x-csrf-token');
done();
});
done();
});
});
describe('when invalid err.status', function(){
@ -67,10 +67,10 @@ describe('ctx.onerror(err)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
});
});
@ -88,10 +88,10 @@ describe('ctx.onerror(err)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
});
});
});
@ -107,10 +107,10 @@ describe('ctx.onerror(err)', function(){
const server = app.listen();
request(server)
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
.get('/')
.expect(500)
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Internal Server Error', done);
});
});
});

View file

@ -16,8 +16,8 @@ describe('ctx.state', function(){
const server = app.listen();
request(server)
.get('/')
.expect(404)
.end(done);
.get('/')
.expect(404)
.end(done);
});
});

View file

@ -40,10 +40,10 @@ describe('ctx.attachment([filename])', function(){
});
request(app.listen())
.get('/')
.expect('content-disposition', 'attachment; filename="include-no-ascii-char-???-ok.json"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.json')
.expect({foo: 'bar'})
.expect(200, done);
.get('/')
.expect('content-disposition', 'attachment; filename="include-no-ascii-char-???-ok.json"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.json')
.expect({foo: 'bar'})
.expect(200, done);
});
});
});

View file

@ -23,8 +23,7 @@ describe('res.lastModified', function(){
const res = response();
const date = new Date();
res.lastModified = date;
(res.lastModified.getTime() / 1000)
.should.equal(Math.floor(date.getTime() / 1000));
(res.lastModified.getTime() / 1000).should.equal(Math.floor(date.getTime() / 1000));
});
describe('when lastModified not set', function(){

View file

@ -85,7 +85,7 @@ describe('res.status=', function(){
});
});
it('should strip content releated header fields after status set', function(done){
it('should strip content releated header fields after status set', done => {
const app = new Koa();
app.use(function(ctx){