Browse Source

test: Sync writables may emit finish before callbacks

v0.9.4-release
isaacs 12 years ago
parent
commit
f8bb031bdc
  1. 12
      test/simple/test-stream2-writable.js

12
test/simple/test-stream2-writable.js

@ -59,6 +59,10 @@ function run() {
var name = next[0]; var name = next[0];
var fn = next[1]; var fn = next[1];
if (!fn)
return run();
console.log('# %s', name); console.log('# %s', name);
fn({ fn({
same: assert.deepEqual, same: assert.deepEqual,
@ -228,9 +232,11 @@ test('write callbacks', function (t) {
}); });
tw.on('finish', function() { tw.on('finish', function() {
t.same(tw.buffer, chunks, 'got chunks in the right order'); process.nextTick(function() {
t.same(callbacks._called, chunks, 'called all callbacks'); t.same(tw.buffer, chunks, 'got chunks in the right order');
t.end(); t.same(callbacks._called, chunks, 'called all callbacks');
t.end();
});
}); });
chunks.forEach(function(chunk, i) { chunks.forEach(function(chunk, i) {

Loading…
Cancel
Save