koa-lite/test/application/context.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
694 B
JavaScript

'use strict';
const request = require('supertest');
const assert = require('assert');
const Koa = require('../..');
describe('app.context', () => {
const app1 = new Koa();
app1.context.msg = 'hello';
const app2 = new Koa();
it('should merge properties', done => {
app1.use((ctx, next) => {
assert.equal(ctx.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.msg, undefined);
ctx.status = 204;
});
request(app2.listen())
.get('/')
.expect(204, done);
});
});