koa-lite/test/application/response.js
broucz 4b1a1da652 test: switch all functions to arrow functions
closes #553

Update test: application -> use() should throw if not a function

Fix lint

Use arrow function

Refactor test using arrow function

Remove non mandatory brackets

fix for merge

Fix: missing refactor after merge

Use arrow function for old generator
2015-11-02 11:22:05 -08:00

34 lines
714 B
JavaScript

'use strict';
const request = require('supertest');
const assert = require('assert');
const Koa = require('../..');
describe('app.response', () => {
const app1 = new Koa();
app1.response.msg = 'hello';
const app2 = new Koa();
it('should merge properties', done => {
app1.use((ctx, next) => {
assert.equal(ctx.response.msg, 'hello');
ctx.status = 204;
});
request(app1.listen())
.get('/')
.expect(204, done);
});
it('should not affect the original prototype', done => {
app2.use((ctx, next) => {
assert.equal(ctx.response.msg, undefined);
ctx.status = 204;
});
request(app2.listen())
.get('/')
.expect(204, done);
});
});