Sha256: 17690ad845eeb4045d5268899b2b571eb9088ff2fb6c9ea6eb353c28103e4bed

Contents?: true

Size: 1.16 KB

Versions: 17

Compression:

Stored size: 1.16 KB

Contents

var assert = require('assert')

var uid = require('./')

describe('uid-url', function () {
  describe('uid()', function () {
    it('should return a uid of the correct length', function () {
      return uid(18).then(function (val) {
        assert.equal(24, Buffer.byteLength(val))
      })
    })

    it('should not contain +, /, or =', function () {
      return uid(100000).then(function (val) {
        assert(!~val.indexOf('+'))
        assert(!~val.indexOf('/'))
        assert(!~val.indexOf('='))
      })
    })

    it('should support callbacks', function (done) {
      uid(1000000, function (err, val) {
        if (err) return done(err)
        assert(!~val.indexOf('+'))
        assert(!~val.indexOf('/'))
        assert(!~val.indexOf('='))
        done()
      })
    })
  })

  describe('uid.sync()', function () {
    it('should return a uid of the correct length', function () {
      var val = uid.sync(18)
      assert.equal(24, Buffer.byteLength(val))
    })

    it('should not contain +, /, or =', function () {
      var val = uid.sync(100000)
      assert(!~val.indexOf('+'))
      assert(!~val.indexOf('/'))
      assert(!~val.indexOf('='))
    })
  })
})

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/express-session/node_modules/uid-safe/test.js