Sha256: f2bbb084853b8ea7099c693bbf3cc33dcaf1357f3599e148986c0b9fb328e02c

Contents?: true

Size: 821 Bytes

Versions: 35

Compression:

Stored size: 821 Bytes

Contents

var test = require('tape')
var crypto = require('./browser')
var Buffer = require('safe-buffer').Buffer
test('sync', function (t) {
  t.test('first', function (t) {
    const buf = Buffer.alloc(10)
    const before = buf.toString('hex')
    crypto.randomFillSync(buf, 5, 5)
    const after = buf.toString('hex')
    t.notEqual(before, after)
    t.equal(before.slice(0, 10), after.slice(0, 10))
    t.end()
  })
})
test('async', function (t) {
  t.test('first', function (t) {
    const buf = Buffer.alloc(10)
    const before = buf.toString('hex')
    crypto.randomFill(buf, 5, 5, function (err, bufa) {
      t.error(err)
      const after = bufa.toString('hex')
      t.notEqual(before, after)
      t.equal(before.slice(0, 10), after.slice(0, 10))
      t.ok(buf === bufa, 'same buffer')
      t.end()
    })
  })
})

Version data entries

35 entries across 34 versions & 12 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/randomfill/test.js
disco_app-0.18.0 test/dummy/node_modules/randomfill/test.js
disco_app-0.18.2 test/dummy/node_modules/randomfill/test.js
disco_app-0.16.1 test/dummy/node_modules/randomfill/test.js
disco_app-0.15.2 test/dummy/node_modules/randomfill/test.js
disco_app-0.18.4 test/dummy/node_modules/randomfill/test.js
disco_app-0.18.1 test/dummy/node_modules/randomfill/test.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/randomfill/test.js
disco_app-0.14.0 test/dummy/node_modules/randomfill/test.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/randomfill/test.js
tang-0.2.1 spec/tang_app/node_modules/randomfill/test.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/randomfill/test.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/randomfill/test.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/randomfill/test.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/randomfill/test.js
tang-0.2.0 spec/tang_app/node_modules/randomfill/test.js
tang-0.1.0 spec/tang_app/node_modules/randomfill/test.js
tang-0.0.9 spec/tang_app/node_modules/randomfill/test.js
enju_library-0.3.8 spec/dummy/node_modules/randomfill/test.js
ilog-0.4.1 node_modules/randomfill/test.js