Blame view

node_modules/msgpack5/test/null.js 445 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  'use strict'
  
  var test = require('tape').test
  var msgpack = require('../')
  
  test('encode/decode null', function (t) {
    var encoder = msgpack()
  
    t.equal(encoder.encode(null)[0], 0xc0, 'encode null as 0xc0')
    t.equal(encoder.encode(null).length, 1, 'encode a buffer of length 1')
    t.equal(encoder.decode(new Buffer([0xc0])), null, 'decode 0xc0 as null')
    t.equal(encoder.decode(encoder.encode(null)), null, 'mirror test null')
  
    t.end()
  })