2 var app = require('../../examples/cookies')
3 , request = require('supertest');
4 var utils = require('../support/utils');
6 describe('cookies', function(){
7 describe('GET /', function(){
8 it('should have a form', function(done){
11 .expect(/<form/, done);
14 it('should respond with no cookies', function(done){
17 .expect(utils.shouldNotHaveHeader('Set-Cookie'))
21 it('should respond to cookie', function(done){
25 .send({ remember: 1 })
26 .expect(302, function(err, res){
27 if (err) return done(err)
30 .set('Cookie', res.headers['set-cookie'][0])
31 .expect(200, /Remembered/, done)
36 describe('GET /forget', function(){
37 it('should clear cookie', function(done){
41 .send({ remember: 1 })
42 .expect(302, function(err, res){
43 if (err) return done(err)
46 .set('Cookie', res.headers['set-cookie'][0])
47 .expect('Set-Cookie', /remember=;/)
53 describe('POST /', function(){
54 it('should set a cookie', function(done){
58 .send({ remember: 1 })
59 .expect('Set-Cookie', /remember=1/)
63 it('should no set cookie w/o reminder', function(done){
67 .expect(utils.shouldNotHaveHeader('Set-Cookie'))