koa-lite/test/context/state.js

23 lines
406 B
JavaScript
Raw Normal View History

'use strict';
const request = require('supertest');
const assert = require('assert');
2015-10-13 06:19:42 +00:00
const Koa = require('../..');
describe('ctx.state', () => {
2017-05-11 03:30:32 +00:00
it('should provide a ctx.state namespace', () => {
2015-10-13 06:19:42 +00:00
const app = new Koa();
app.use(ctx => {
assert.deepEqual(ctx.state, {});
});
const server = app.listen();
2017-05-11 03:30:32 +00:00
return request(server)
.get('/')
2017-05-11 03:30:32 +00:00
.expect(404);
2015-10-12 20:36:41 +00:00
});
});