60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
79 lines
1.8 KiB
Markdown
79 lines
1.8 KiB
Markdown
# merge-stream
|
|
|
|
Merge (interleave) a bunch of streams.
|
|
|
|
[](http://travis-ci.org/grncdr/merge-stream)
|
|
|
|
## Synopsis
|
|
|
|
```javascript
|
|
var stream1 = new Stream();
|
|
var stream2 = new Stream();
|
|
|
|
var merged = mergeStream(stream1, stream2);
|
|
|
|
var stream3 = new Stream();
|
|
merged.add(stream3);
|
|
merged.isEmpty();
|
|
//=> false
|
|
```
|
|
|
|
## Description
|
|
|
|
This is adapted from [event-stream](https://github.com/dominictarr/event-stream) separated into a new module, using Streams3.
|
|
|
|
## API
|
|
|
|
### `mergeStream`
|
|
|
|
Type: `function`
|
|
|
|
Merges an arbitrary number of streams. Returns a merged stream.
|
|
|
|
#### `merged.add`
|
|
|
|
A method to dynamically add more sources to the stream. The argument supplied to `add` can be either a source or an array of sources.
|
|
|
|
#### `merged.isEmpty`
|
|
|
|
A method that tells you if the merged stream is empty.
|
|
|
|
When a stream is "empty" (aka. no sources were added), it could not be returned to a gulp task.
|
|
|
|
So, we could do something like this:
|
|
|
|
```js
|
|
stream = require('merge-stream')();
|
|
// Something like a loop to add some streams to the merge stream
|
|
// stream.add(streamA);
|
|
// stream.add(streamB);
|
|
return stream.isEmpty() ? null : stream;
|
|
```
|
|
|
|
## Gulp example
|
|
|
|
An example use case for **merge-stream** is to combine parts of a task in a project's **gulpfile.js** like this:
|
|
|
|
```js
|
|
const gulp = require('gulp');
|
|
const htmlValidator = require('gulp-w3c-html-validator');
|
|
const jsHint = require('gulp-jshint');
|
|
const mergeStream = require('merge-stream');
|
|
|
|
function lint() {
|
|
return mergeStream(
|
|
gulp.src('src/*.html')
|
|
.pipe(htmlValidator())
|
|
.pipe(htmlValidator.reporter()),
|
|
gulp.src('src/*.js')
|
|
.pipe(jsHint())
|
|
.pipe(jsHint.reporter())
|
|
);
|
|
}
|
|
gulp.task('lint', lint);
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|