forked from expressjs/express
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathres.clearCookie.js
35 lines (28 loc) · 869 Bytes
/
res.clearCookie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var express = require('../')
, request = require('supertest');
describe('res', function(){
describe('.clearCookie(name)', function(){
it('should set a cookie passed expiry', function(done){
var app = express();
app.use(function(req, res){
res.clearCookie('sid').end();
});
request(app)
.get('/')
.expect('Set-Cookie', 'sid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
.expect(200, done)
})
})
describe('.clearCookie(name, options)', function(){
it('should set the given params', function(done){
var app = express();
app.use(function(req, res){
res.clearCookie('sid', { path: '/admin' }).end();
});
request(app)
.get('/')
.expect('Set-Cookie', 'sid=; Path=/admin; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
.expect(200, done)
})
})
})