examples/cookies/test.js
Kevin Rambaud fc7f25a73f Fix mocha version and unit tests (#117)
* Remove duplicate supertest dependency

* Fix mocha version

* Add an after statement to close koa app instance after running tests
2018-01-24 19:10:06 +08:00

22 lines
534 B
JavaScript

const app = require('./app');
const server = app.listen();
const request = require('supertest').agent(server);
describe('Cookies Views', function() {
after(function() {
server.close();
});
[1, 2, 3].forEach(function(i) {
describe('on iteration #' + i, function() {
it('should set the views as a cookie and as the body', function(done) {
request
.get('/')
.expect(200)
.expect('Set-Cookie', new RegExp('view=' + i))
.expect(i + ' views', done);
});
});
});
});