fix(deps)!: mime-types@^3.0.0 (#5882)
[express.git] / test / res.clearCookie.js
blob74a746eb7be3d4510bba21014455c73d3eebc0ec
1 'use strict'
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){
9 var app = express();
11 app.use(function(req, res){
12 res.clearCookie('sid').end();
13 });
15 request(app)
16 .get('/')
17 .expect('Set-Cookie', 'sid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
18 .expect(200, done)
22 describe('.clearCookie(name, options)', function(){
23 it('should set the given params', function(done){
24 var app = express();
26 app.use(function(req, res){
27 res.clearCookie('sid', { path: '/admin' }).end();
28 });
30 request(app)
31 .get('/')
32 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
33 .expect(200, done)
36 it('should ignore maxAge', function(done){
37 var app = express();
39 app.use(function(req, res){
40 res.clearCookie('sid', { path: '/admin', maxAge: 1000 }).end();
41 });
43 request(app)
44 .get('/')
45 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
46 .expect(200, done)
49 it('should ignore user supplied expires param', function(done){
50 var app = express();
52 app.use(function(req, res){
53 res.clearCookie('sid', { path: '/admin', expires: new Date() }).end();
54 });
56 request(app)
57 .get('/')
58 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
59 .expect(200, done)