3 var express
= require('../')
4 , request
= require('supertest');
6 describe('res', function(){
7 describe('.clearCookie(name)', function(){
8 it('should set a cookie passed expiry', function(done
){
11 app
.use(function(req
, res
){
12 res
.clearCookie('sid').end();
17 .expect('Set-Cookie', 'sid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
22 describe('.clearCookie(name, options)', function(){
23 it('should set the given params', function(done
){
26 app
.use(function(req
, res
){
27 res
.clearCookie('sid', { path
: '/admin' }).end();
32 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
36 it('should ignore maxAge', function(done
){
39 app
.use(function(req
, res
){
40 res
.clearCookie('sid', { path
: '/admin', maxAge
: 1000 }).end();
45 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
49 it('should ignore user supplied expires param', function(done
){
52 app
.use(function(req
, res
){
53 res
.clearCookie('sid', { path
: '/admin', expires
: new Date() }).end();
58 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')