res.clearCookie.js
This file
Path
test/res.clearCookie.js
62 lines · 1.6 KiB · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 2027b87 point at it.
fix(deps): cookie@0.7.0Josh Bukerbefore adoption2027b87
lines 1–62why, one step back1'use strict'23var express = require('../')4 , request = require('supertest');56describe('res', function(){7 describe('.clearCookie(name)', function(){8 it('should set a cookie passed expiry', function(done){9 var app = express();1011 app.use(function(req, res){12 res.clearCookie('sid').end();13 });1415 request(app)16 .get('/')17 .expect('Set-Cookie', 'sid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT')18 .expect(200, done)19 })20 })2122 describe('.clearCookie(name, options)', function(){23 it('should set the given params', function(done){24 var app = express();2526 app.use(function(req, res){27 res.clearCookie('sid', { path: '/admin' }).end();28 });2930 request(app)31 .get('/')32 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')33 .expect(200, done)34 })3536 it('should ignore maxAge', function(done){37 var app = express();3839 app.use(function(req, res){40 res.clearCookie('sid', { path: '/admin', maxAge: 1000 }).end();41 });4243 request(app)44 .get('/')45 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')46 .expect(200, done)47 })4849 it('should ignore user supplied expires param', function(done){50 var app = express();5152 app.use(function(req, res){53 res.clearCookie('sid', { path: '/admin', expires: new Date() }).end();54 });5556 request(app)57 .get('/')58 .expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')59 .expect(200, done)60 })61 })62})