ce4c83ff
wxy
初始提交
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
'use strict';
var assert = require('assert');
var stream = require('stream');
var hash = require('../index');
describe('writeToStream', function() {
it('should emit information about an object to a stream', function() {
var strm = new stream.PassThrough();
hash.writeToStream({foo: 'bar'}, strm);
var result = strm.read().toString();
assert.strictEqual(typeof result, 'string');
assert.notStrictEqual(result.indexOf('foo'), -1);
assert.notStrictEqual(result.indexOf('bar'), -1);
});
it('should leave out keys when excludeValues = true', function() {
var strm = new stream.PassThrough();
hash.writeToStream({foo: 'bar'}, {excludeValues: true}, strm);
var result = strm.read().toString();
assert.strictEqual(typeof result, 'string');
assert.notStrictEqual(result.indexOf('foo'), -1);
assert. strictEqual(result.indexOf('bar'), -1);
});
});
|