File: chat-websocket/node_modules/express/node_modules/cookie/test/serialize.js

Recommend this page to a friend!
  Classes of Igor Escobar   Terminal Crossword   chat-websocket/node_modules/express/node_modules/cookie/test/serialize.js   Download  
File: chat-websocket/node_modules/express/node_modules/cookie/test/serialize.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 2 years ago
Size: 1,406 bytes
 

Contents

Class file image Download
// builtin var assert = require('assert'); var cookie = require('..'); suite('serialize'); test('basic', function() { assert.equal('foo=bar', cookie.serialize('foo', 'bar')); assert.equal('foo=bar%20baz', cookie.serialize('foo', 'bar baz')); }); test('path', function() { assert.equal('foo=bar; Path=/', cookie.serialize('foo', 'bar', { path: '/' })); }); test('secure', function() { assert.equal('foo=bar; Secure', cookie.serialize('foo', 'bar', { secure: true })); assert.equal('foo=bar', cookie.serialize('foo', 'bar', { secure: false })); }); test('domain', function() { assert.equal('foo=bar; Domain=example.com', cookie.serialize('foo', 'bar', { domain: 'example.com' })); }); test('httpOnly', function() { assert.equal('foo=bar; HttpOnly', cookie.serialize('foo', 'bar', { httpOnly: true })); }); test('maxAge', function() { assert.equal('foo=bar; Max-Age=1000', cookie.serialize('foo', 'bar', { maxAge: 1000 })); }); test('escaping', function() { assert.deepEqual('cat=%2B%20', cookie.serialize('cat', '+ ')); }); test('parse->serialize', function() { assert.deepEqual({ cat: 'foo=123&name=baz five' }, cookie.parse( cookie.serialize('cat', 'foo=123&name=baz five'))); assert.deepEqual({ cat: ' ";/' }, cookie.parse( cookie.serialize('cat', ' ";/'))); });