Sha256: 4fadc64c18fc04f071af9ecaa011caffd0bc198a6ab1cfc9c40236ca536651ca

Contents?: true

Size: 987 Bytes

Versions: 112

Compression:

Stored size: 987 Bytes

Contents

var tape = require('tape')
  , caseless = require('./')
  ;

tape('set get has', function (t) {
  var headers = {}
    , c = caseless(headers)
    ;
  t.plan(17)
  c.set('a-Header', 'asdf')
  t.equal(c.get('a-header'), 'asdf')
  t.equal(c.has('a-header'), 'a-Header')
  t.ok(!c.has('nothing'))
  // old bug where we used the wrong regex
  t.ok(!c.has('a-hea'))
  c.set('a-header', 'fdsa')
  t.equal(c.get('a-header'), 'fdsa')
  t.equal(c.get('a-Header'), 'fdsa')
  c.set('a-HEADER', 'more', false)
  t.equal(c.get('a-header'), 'fdsa,more')

  t.deepEqual(headers, {'a-Header': 'fdsa,more'})
  c.swap('a-HEADER')
  t.deepEqual(headers, {'a-HEADER': 'fdsa,more'})

  c.set('deleteme', 'foobar')
  t.ok(c.has('deleteme'))
  t.ok(c.del('deleteme'))
  t.notOk(c.has('deleteme'))
  t.notOk(c.has('idonotexist'))
  t.ok(c.del('idonotexist'))

  c.set('tva', 'test1')
  c.set('tva-header', 'test2')
  t.equal(c.has('tva'), 'tva')
  t.notOk(c.has('header'))

  t.equal(c.get('tva'), 'test1')

})

Version data entries

112 entries across 104 versions & 12 rubygems

Version Path
trusty-festivity-extension-2.4.4 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.4.3 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.4.2 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.4.1 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.4.0 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.30 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.29 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.28 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.27 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.26 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.25 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.24 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.23 node_modules/bower/node_modules/request/node_modules/caseless/test.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/caseless/test.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/caseless/test.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.22 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.21 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.20 node_modules/bower/node_modules/request/node_modules/caseless/test.js
trusty-festivity-extension-2.3.19 node_modules/bower/node_modules/request/node_modules/caseless/test.js