Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
chai-stream
Advanced tools
Readme
Extends Chai with assertions about streams.
npm install --save-dev chai-stream
define(function(require, exports, module) {
var chai = require('chai');
var chaiStream = require('chai-stream');
chai.use(chaiStream);
});
<script src="chai.js"></script>
<script src="chai-stream.js"></script>
var chai = require('chai');
var chaiStream = require('chai-stream');
chai.use(chaiStream);
var expect = chai.expect;
describe('getMyStream', function() {
it('should return a readable stream', function() {
var stream = getMyStream();
expect(stream).to.be.a.ReadableStream;
});
it('should return a stream that will end', function() {
var stream = getMyStream();
return expect(stream).to.end;
});
});
Type: function(any)
This assertion check that the specified object have a pipe
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any)
This assertion check that the specified object have a pipe
and resume
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any)
This assertion check that the specified object have a pipe
and write
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any): Promise<void>
Returns a promise that fulfilled when a end
event is fired.
And this function force the stream to read (like piping with WritableStream
).
Type: any
waitUntilStreamEnd
listen end
or error
event of the stream.
var chai = require('chai');
var chaiStream = require('chai-stream');
chai.use(chaiStream);
var assert = chai.assert;
describe('getMyStream', function() {
it('should return a readable stream', function() {
var stream = getMyStream();
assert.isReadableStream(stream);
});
it('should return a stream that will end', function() {
var stream = getMyStream();
return assert.streamWillEnd(stream);
});
});
Type: function(any)
This assertion check that the specified object have a pipe
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any)
This assertion check that the specified object have a pipe
and resume
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any)
This assertion check that the specified object have a pipe
and write
method.
So, it pass streams that not inherit Node's Stream.
Type: any
Type: function(any): Promise<void>
Returns a promise that fulfilled when a end
event is fired.
And this function force the stream to read (like piping with WritableStream
).
Type: any
waitUntilStreamEnd
listen end
or error
event of the stream.
FAQs
Extends Chai with assertions about streams.
The npm package chai-stream receives a total of 78 weekly downloads. As such, chai-stream popularity was classified as not popular.
We found that chai-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.