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.228 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.227 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.226 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.225 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.224 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.9 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.223 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.222 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.221 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.220 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.219 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.218 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.217 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.216 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.215 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.214 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.213 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.212 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.211 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js
smock-0.1.210 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/test/static.js