Sha256: f64e30895de1d3804bf5cc200bd8f7fd7d4f1fdb117674893ae0de2be81d3e98

Contents?: true

Size: 884 Bytes

Versions: 62

Compression:

Stored size: 884 Bytes

Contents

var B = require('../').Buffer
var test = require('tape')
if (process.env.OBJECT_IMPL) B.TYPED_ARRAY_SUPPORT = false


test('Buffer.isEncoding', function (t) {
  t.equal(B.isEncoding('HEX'), true)
  t.equal(B.isEncoding('hex'), true)
  t.equal(B.isEncoding('bad'), false)
  t.end()
})

test('Buffer.isBuffer', function (t) {
  t.equal(B.isBuffer(new B('hey', 'utf8')), true)
  t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true)
  t.equal(B.isBuffer('hey'), false)
  t.end()
})

test('Buffer.toArrayBuffer', function (t) {
  var data = [1, 2, 3, 4, 5, 6, 7, 8]
  if (typeof Uint8Array !== 'undefined') {
    var result = new B(data).toArrayBuffer()
    var expected = new Uint8Array(data).buffer
    for (var i = 0; i < expected.byteLength; i++) {
      t.equal(result[i], expected[i])
    }
  } else {
    t.pass('No toArrayBuffer() method provided in old browsers')
  }
  t.end()
})

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
smock-0.1.268 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.267 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.266 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.265 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.264 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.263 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.262 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.261 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.260 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.259 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.258 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.256 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.255 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.254 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.253 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.252 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.251 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.250 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.249 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.247 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js