source: trip-planner-front/node_modules/is-buffer/test/basic.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 958 bytes
Line 
1var isBuffer = require('../')
2var test = require('tape')
3
4test('is-buffer', function (t) {
5 t.equal(isBuffer(Buffer.alloc(4)), true, 'new Buffer(4)')
6 t.equal(isBuffer(Buffer.allocUnsafeSlow(100)), true, 'SlowBuffer(100)')
7
8 t.equal(isBuffer(undefined), false, 'undefined')
9 t.equal(isBuffer(null), false, 'null')
10 t.equal(isBuffer(''), false, 'empty string')
11 t.equal(isBuffer(true), false, 'true')
12 t.equal(isBuffer(false), false, 'false')
13 t.equal(isBuffer(0), false, '0')
14 t.equal(isBuffer(1), false, '1')
15 t.equal(isBuffer(1.0), false, '1.0')
16 t.equal(isBuffer('string'), false, 'string')
17 t.equal(isBuffer({}), false, '{}')
18 t.equal(isBuffer([]), false, '[]')
19 t.equal(isBuffer(function foo () {}), false, 'function foo () {}')
20 t.equal(isBuffer({ isBuffer: null }), false, '{ isBuffer: null }')
21 t.equal(isBuffer({ isBuffer: function () { throw new Error() } }), false, '{ isBuffer: function () { throw new Error() } }')
22
23 t.end()
24})
Note: See TracBrowser for help on using the repository browser.