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.
108 lines
3.5 KiB
JavaScript
108 lines
3.5 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = groupBy;
|
|
|
|
var _groupByLimit = require('./groupByLimit.js');
|
|
|
|
var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
/**
|
|
* Returns a new object, where each value corresponds to an array of items, from
|
|
* `coll`, that returned the corresponding key. That is, the keys of the object
|
|
* correspond to the values passed to the `iteratee` callback.
|
|
*
|
|
* Note: Since this function applies the `iteratee` to each item in parallel,
|
|
* there is no guarantee that the `iteratee` functions will complete in order.
|
|
* However, the values for each key in the `result` will be in the same order as
|
|
* the original `coll`. For Objects, the values will roughly be in the order of
|
|
* the original Objects' keys (but this can vary across JavaScript engines).
|
|
*
|
|
* @name groupBy
|
|
* @static
|
|
* @memberOf module:Collections
|
|
* @method
|
|
* @category Collection
|
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
* `coll`.
|
|
* The iteratee should complete with a `key` to group the value under.
|
|
* Invoked with (value, callback).
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
* functions have finished, or an error occurs. Result is an `Object` whoses
|
|
* properties are arrays of values which returned the corresponding key.
|
|
* @returns {Promise} a promise, if no callback is passed
|
|
* @example
|
|
*
|
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
* // dir3 is a directory that contains file5.txt
|
|
* // dir4 does not exist
|
|
*
|
|
* const files = ['dir1/file1.txt','dir2','dir4']
|
|
*
|
|
* // asynchronous function that detects file type as none, file, or directory
|
|
* function detectFile(file, callback) {
|
|
* fs.stat(file, function(err, stat) {
|
|
* if (err) {
|
|
* return callback(null, 'none');
|
|
* }
|
|
* callback(null, stat.isDirectory() ? 'directory' : 'file');
|
|
* });
|
|
* }
|
|
*
|
|
* //Using callbacks
|
|
* async.groupBy(files, detectFile, function(err, result) {
|
|
* if(err) {
|
|
* console.log(err);
|
|
* } else {
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }
|
|
* });
|
|
*
|
|
* // Using Promises
|
|
* async.groupBy(files, detectFile)
|
|
* .then( result => {
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }).catch( err => {
|
|
* console.log(err);
|
|
* });
|
|
*
|
|
* // Using async/await
|
|
* async () => {
|
|
* try {
|
|
* let result = await async.groupBy(files, detectFile);
|
|
* console.log(result);
|
|
* // {
|
|
* // file: [ 'dir1/file1.txt' ],
|
|
* // none: [ 'dir4' ],
|
|
* // directory: [ 'dir2']
|
|
* // }
|
|
* // result is object containing the files grouped by type
|
|
* }
|
|
* catch (err) {
|
|
* console.log(err);
|
|
* }
|
|
* }
|
|
*
|
|
*/
|
|
function groupBy(coll, iteratee, callback) {
|
|
return (0, _groupByLimit2.default)(coll, Infinity, iteratee, callback);
|
|
}
|
|
module.exports = exports.default; |