 aacb45156b
			
		
	
	aacb45156b
	
	
	
		
			
			- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			115 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			115 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| Object.defineProperty(exports, "__esModule", {
 | |
|     value: true
 | |
| });
 | |
| 
 | |
| var _concatLimit = require('./concatLimit.js');
 | |
| 
 | |
| var _concatLimit2 = _interopRequireDefault(_concatLimit);
 | |
| 
 | |
| var _awaitify = require('./internal/awaitify.js');
 | |
| 
 | |
| var _awaitify2 = _interopRequireDefault(_awaitify);
 | |
| 
 | |
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | |
| 
 | |
| /**
 | |
|  * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
 | |
|  * the concatenated list. The `iteratee`s are called in parallel, and the
 | |
|  * results are concatenated as they return. The results array will be returned in
 | |
|  * the original order of `coll` passed to the `iteratee` function.
 | |
|  *
 | |
|  * @name concat
 | |
|  * @static
 | |
|  * @memberOf module:Collections
 | |
|  * @method
 | |
|  * @category Collection
 | |
|  * @alias flatMap
 | |
|  * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 | |
|  * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
 | |
|  * which should use an array as its result. Invoked with (item, callback).
 | |
|  * @param {Function} [callback] - A callback which is called after all the
 | |
|  * `iteratee` functions have finished, or an error occurs. Results is an array
 | |
|  * containing the concatenated results of the `iteratee` function. Invoked with
 | |
|  * (err, results).
 | |
|  * @returns 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
 | |
|  *
 | |
|  * let directoryList = ['dir1','dir2','dir3'];
 | |
|  * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
 | |
|  *
 | |
|  * // Using callbacks
 | |
|  * async.concat(directoryList, fs.readdir, function(err, results) {
 | |
|  *    if (err) {
 | |
|  *        console.log(err);
 | |
|  *    } else {
 | |
|  *        console.log(results);
 | |
|  *        // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 | |
|  *    }
 | |
|  * });
 | |
|  *
 | |
|  * // Error Handling
 | |
|  * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
 | |
|  *    if (err) {
 | |
|  *        console.log(err);
 | |
|  *        // [ Error: ENOENT: no such file or directory ]
 | |
|  *        // since dir4 does not exist
 | |
|  *    } else {
 | |
|  *        console.log(results);
 | |
|  *    }
 | |
|  * });
 | |
|  *
 | |
|  * // Using Promises
 | |
|  * async.concat(directoryList, fs.readdir)
 | |
|  * .then(results => {
 | |
|  *     console.log(results);
 | |
|  *     // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 | |
|  * }).catch(err => {
 | |
|  *      console.log(err);
 | |
|  * });
 | |
|  *
 | |
|  * // Error Handling
 | |
|  * async.concat(withMissingDirectoryList, fs.readdir)
 | |
|  * .then(results => {
 | |
|  *     console.log(results);
 | |
|  * }).catch(err => {
 | |
|  *     console.log(err);
 | |
|  *     // [ Error: ENOENT: no such file or directory ]
 | |
|  *     // since dir4 does not exist
 | |
|  * });
 | |
|  *
 | |
|  * // Using async/await
 | |
|  * async () => {
 | |
|  *     try {
 | |
|  *         let results = await async.concat(directoryList, fs.readdir);
 | |
|  *         console.log(results);
 | |
|  *         // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 | |
|  *     } catch (err) {
 | |
|  *         console.log(err);
 | |
|  *     }
 | |
|  * }
 | |
|  *
 | |
|  * // Error Handling
 | |
|  * async () => {
 | |
|  *     try {
 | |
|  *         let results = await async.concat(withMissingDirectoryList, fs.readdir);
 | |
|  *         console.log(results);
 | |
|  *     } catch (err) {
 | |
|  *         console.log(err);
 | |
|  *         // [ Error: ENOENT: no such file or directory ]
 | |
|  *         // since dir4 does not exist
 | |
|  *     }
 | |
|  * }
 | |
|  *
 | |
|  */
 | |
| function concat(coll, iteratee, callback) {
 | |
|     return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
 | |
| }
 | |
| exports.default = (0, _awaitify2.default)(concat, 3);
 | |
| module.exports = exports.default; |