e8703f600a64dabdb67ccb42512781506f6f9461f9002fa8a1b980d51ef30a4ed53b15ebea53bda9bdf80ebe6014d5e31fe1a6a943442bb3b22e6e7f5f365b 909 B

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