Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80538 views
1
var concat = require('../')
2
var test = require('tape')
3
4
test('type inference works as expected', function(t) {
5
var stream = concat()
6
t.equal(stream.inferEncoding(['hello']), 'array', 'array')
7
t.equal(stream.inferEncoding(new Buffer('hello')), 'buffer', 'buffer')
8
t.equal(stream.inferEncoding(undefined), 'buffer', 'buffer')
9
t.equal(stream.inferEncoding(new Uint8Array(1)), 'uint8array', 'uint8array')
10
t.equal(stream.inferEncoding('hello'), 'string', 'string')
11
t.equal(stream.inferEncoding(''), 'string', 'string')
12
t.equal(stream.inferEncoding({hello: "world"}), 'object', 'object')
13
t.equal(stream.inferEncoding(1), 'buffer', 'buffer')
14
t.end()
15
})
16
17