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.
3.0 KiB
p-map 
Map over promises concurrently
Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently.
Install
$ npm install p-map
Usage
const pMap = require('p-map');
const got = require('got');
const sites = [
getWebsiteFromUsername('https://sindresorhus'), //=> Promise
'https://ava.li',
'https://github.com'
];
(async () => {
const mapper = async site => {
const {requestUrl} = await got.head(site);
return requestUrl;
};
const result = await pMap(sites, mapper, {concurrency: 2});
console.log(result);
//=> ['https://sindresorhus.com/', 'https://ava.li/', 'https://github.com/']
})();
API
pMap(input, mapper, options?)
Returns a Promise that is fulfilled when all promises in input and ones returned from mapper are fulfilled, or rejects if any of the promises reject. The fulfilled value is an Array of the fulfilled values returned from mapper in input order.
input
Type: Iterable<Promise | unknown>
Iterated over concurrently in the mapper function.
mapper(element, index)
Type: Function
Expected to return a Promise or value.
options
Type: object
concurrency
Type: number (Integer)
Default: Infinity
Minimum: 1
Number of concurrently pending promises returned by mapper.
stopOnError
Type: boolean
Default: true
When set to false, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an aggregated error containing all the errors from the rejected promises.
p-map for enterprise
Available as part of the Tidelift Subscription.
The maintainers of p-map and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
Related
- p-all - Run promise-returning & async functions concurrently with optional limited concurrency
- p-filter - Filter promises concurrently
- p-times - Run promise-returning & async functions a specific number of times concurrently
- p-props - Like
Promise.all()but forMapandObject - p-map-series - Map over promises serially
- p-queue - Promise queue with concurrency control
- More…