Closed huang-xiao-jian closed 10 years ago
Hi: It seems that, there is several bugs on chained stream assertion. Shared code
var array = require('stream-array'); var assert = require('stream-assert'); var should = require('should');
When test like this, timeout error happened
describe('chain assertion test', function() { it('chain assertion', function(done) { array([1, 2, 3]) .pipe(assert.first(function(data) { data.should.eql(1);})) .pipe(assert.second(function(data) { data.should.eql(2);})) .pipe(assert.nth(2, function(data) { data.should.eql(3); })) .on('end', done) }) })
When test like below, test case success, It seems that nth method doesn't support chained assertion.
nth
describe('chain assertion test', function() { it('chain assertion', function(done) { array([1, 2, 3]) .pipe(assert.first(function(data) { data.should.eql(1);})) .pipe(assert.second(function(data) { data.should.eql(2);})) .on('end', done) .pipe(assert.nth(2, function(data) { data.should.eql(3); })) }) })
Also, in below case, It still success, which should fail.
describe('chain assertion test', function() { it('chain assertion', function(done) { array([1, 2, 3]) .pipe(assert.first(function(data) { data.should.eql(1);})) .pipe(assert.second(function(data) { data.should.eql(100);})) .on('end', done) .pipe(assert.nth(2, function(data) { data.should.eql(3); })) }) })
API have changed in 2.0.0, now you should use assert.end instead of on('end').
2.0.0
assert.end
on('end')
In last example you should replace on('end', done) to on('assertion', done).
on('end', done)
on('assertion', done)
Hi: It seems that, there is several bugs on chained stream assertion. Shared code
When test like this, timeout error happened
When test like below, test case success, It seems that
nth
method doesn't support chained assertion.Also, in below case, It still success, which should fail.