2014-11-18 08:54:14 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-05 18:23:47 +00:00
|
|
|
const request = require('supertest');
|
|
|
|
const assert = require('assert');
|
2015-10-13 06:19:42 +00:00
|
|
|
const Koa = require('../..');
|
2014-11-18 08:54:14 +00:00
|
|
|
|
2015-10-12 20:36:41 +00:00
|
|
|
describe('ctx.state', function(){
|
|
|
|
it('should provide a ctx.state namespace', function(done){
|
2015-10-13 06:19:42 +00:00
|
|
|
const app = new Koa();
|
2014-11-18 08:54:14 +00:00
|
|
|
|
2015-10-14 00:45:18 +00:00
|
|
|
app.use(function *(ctx){
|
|
|
|
assert.deepEqual(ctx.state, {});
|
2014-11-18 08:54:14 +00:00
|
|
|
});
|
|
|
|
|
2015-10-05 18:23:47 +00:00
|
|
|
const server = app.listen();
|
2014-11-18 08:54:14 +00:00
|
|
|
|
|
|
|
request(server)
|
|
|
|
.get('/')
|
|
|
|
.expect(404)
|
|
|
|
.end(done);
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|