blob: f17cfb3299a9e9ed94212d4cabff34b5c86201b8 (
plain)
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
|
var Cookie = require('../vendor/cookie')
, assert = require('assert');
var str = 'sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT';
var cookie = new Cookie(str);
// test .toString()
assert.equal(cookie.toString(), str);
// test .path
assert.equal(cookie.path, '/');
// test .httpOnly
assert.equal(cookie.httpOnly, true);
// test .name
assert.equal(cookie.name, 'sid');
// test .value
assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="');
// test .expires
assert.equal(cookie.expires instanceof Date, true);
// test .path default
var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' });
assert.equal(cookie.path, '/bar');
console.log('All tests passed');
|