This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/object-hash/test/writeToStream.js

28 lines
909 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
'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);
});
});