flow-mock-read
Provides a mock sink for readable streams.
Installation
$ npm install flow-mock-read
For use in the browser, use browserify.
Usage
To create a mock sink (writeable) stream,
var mock = ;
The method accepts two input arguments: a readable stream and a callback to invoke after reading all data values.
var eventStream = ;// Simulate some data:var data = 100 ;for var i = 0; i < datalength; i++data i = Math*100;// Create a readable stream:var readStream = eventStream;// Start streaming...;
Examples
To run the example code from the top-level application directory,
$ node ./examples/index.js
Notes
The mock implements the classic stream paradigm in Node; e.g., using event listeners.
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ open reports/coverage/lcov-report/index.html
License
Copyright
Copyright © 2014. Athan Reines.