aboutsummaryrefslogtreecommitdiff
path: root/node_modules/bl/test/convert.js
blob: 9f3e23599e3adc0c8eddbe01bfd4b24e02e44340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict'

const tape = require('tape')
const { BufferList, BufferListStream } = require('../')
const { Buffer } = require('buffer')

tape('convert from BufferList to BufferListStream', (t) => {
  const data = Buffer.from(`TEST-${Date.now()}`)
  const bl = new BufferList(data)
  const bls = new BufferListStream(bl)
  t.ok(bl.slice().equals(bls.slice()))
  t.end()
})

tape('convert from BufferListStream to BufferList', (t) => {
  const data = Buffer.from(`TEST-${Date.now()}`)
  const bls = new BufferListStream(data)
  const bl = new BufferList(bls)
  t.ok(bl.slice().equals(bls.slice()))
  t.end()
})