~stephen-stewart/+junk/add-grunt

« back to all changes in this revision

Viewing changes to node_modules/grunt-contrib-cssmin/node_modules/maxmin/node_modules/gzip-size/node_modules/concat-stream/test/objects.js

  • Committer: Stephen Stewart
  • Date: 2014-05-13 01:26:55 UTC
  • Revision ID: stephen.stewart@canonical.com-20140513012655-wx8xbwcdohofxoyj
add --production node_modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var concat = require('../')
 
2
var test = require('tape')
 
3
 
 
4
test('writing objects', function (t) {
 
5
  var stream = concat({encoding: "objects"}, concatted)
 
6
  function concatted(objs) {
 
7
    t.equal(objs.length, 2)
 
8
    t.deepEqual(objs[0], {"foo": "bar"})
 
9
    t.deepEqual(objs[1], {"baz": "taco"})
 
10
  }
 
11
  stream.write({"foo": "bar"})
 
12
  stream.write({"baz": "taco"})
 
13
  stream.end()
 
14
  t.end()
 
15
})
 
16
 
 
17
 
 
18
test('switch to objects encoding if no encoding specified and objects are written', function (t) {
 
19
  var stream = concat(concatted)
 
20
  function concatted(objs) {
 
21
    t.equal(objs.length, 2)
 
22
    t.deepEqual(objs[0], {"foo": "bar"})
 
23
    t.deepEqual(objs[1], {"baz": "taco"})
 
24
  }
 
25
  stream.write({"foo": "bar"})
 
26
  stream.write({"baz": "taco"})
 
27
  stream.end()
 
28
  t.end()
 
29
})