X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fwebsocket%2Fnode_modules%2Ftypedarray-to-buffer%2Ftest%2Fbasic.js;fp=node_modules%2Fwebsocket%2Fnode_modules%2Ftypedarray-to-buffer%2Ftest%2Fbasic.js;h=0000000000000000000000000000000000000000;hp=352109682f5c121df3811f202b255d2c9a47294a;hb=5e96dd57ddd883604e87f62bdddcb111c63a6e1a;hpb=acb5f682a2b75b972710cabd81658f63071324b0 diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js b/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js deleted file mode 100644 index 3521096..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js +++ /dev/null @@ -1,50 +0,0 @@ -var test = require('tape') -var toBuffer = require('../') - -test('convert to buffer from Uint8Array', function (t) { - if (typeof Uint8Array !== 'undefined') { - var arr = new Uint8Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 2, 3]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt8(0), 1) - t.equal(arr.readUInt8(1), 2) - t.equal(arr.readUInt8(2), 3) - } else { - t.pass('browser lacks Uint8Array support, skip test') - } - t.end() -}) - -test('convert to buffer from another arrayview type (Uint32Array)', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 1) - t.equal(arr.readUInt32LE(4), 2) - t.equal(arr.readUInt32LE(8), 3) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks Uint32Array support, skip test') - } - t.end() -}) - -test('convert to buffer from ArrayBuffer', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]).subarray(1, 2) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([2, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 2) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks ArrayBuffer support, skip test') - } - t.end() -})