Set up comprehensive frontend testing infrastructure
- 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>
This commit is contained in:
81
frontend/node_modules/@testing-library/react/dist/act-compat.js
generated
vendored
Normal file
81
frontend/node_modules/@testing-library/react/dist/act-compat.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports.getIsReactActEnvironment = getIsReactActEnvironment;
|
||||
exports.setReactActEnvironment = setIsReactActEnvironment;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var DeprecatedReactTestUtils = _interopRequireWildcard(require("react-dom/test-utils"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
const reactAct = typeof React.act === 'function' ? React.act : DeprecatedReactTestUtils.act;
|
||||
function getGlobalThis() {
|
||||
/* istanbul ignore else */
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
return globalThis;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (typeof global !== 'undefined') {
|
||||
return global;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
throw new Error('unable to locate global object');
|
||||
}
|
||||
function setIsReactActEnvironment(isReactActEnvironment) {
|
||||
getGlobalThis().IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment;
|
||||
}
|
||||
function getIsReactActEnvironment() {
|
||||
return getGlobalThis().IS_REACT_ACT_ENVIRONMENT;
|
||||
}
|
||||
function withGlobalActEnvironment(actImplementation) {
|
||||
return callback => {
|
||||
const previousActEnvironment = getIsReactActEnvironment();
|
||||
setIsReactActEnvironment(true);
|
||||
try {
|
||||
// The return value of `act` is always a thenable.
|
||||
let callbackNeedsToBeAwaited = false;
|
||||
const actResult = actImplementation(() => {
|
||||
const result = callback();
|
||||
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
||||
callbackNeedsToBeAwaited = true;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
if (callbackNeedsToBeAwaited) {
|
||||
const thenable = actResult;
|
||||
return {
|
||||
then: (resolve, reject) => {
|
||||
thenable.then(returnValue => {
|
||||
setIsReactActEnvironment(previousActEnvironment);
|
||||
resolve(returnValue);
|
||||
}, error => {
|
||||
setIsReactActEnvironment(previousActEnvironment);
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
};
|
||||
} else {
|
||||
setIsReactActEnvironment(previousActEnvironment);
|
||||
return actResult;
|
||||
}
|
||||
} catch (error) {
|
||||
// Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT
|
||||
// or if we have to await the callback first.
|
||||
setIsReactActEnvironment(previousActEnvironment);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
const act = withGlobalActEnvironment(reactAct);
|
||||
var _default = exports.default = act;
|
||||
/* eslint no-console:0 */
|
||||
Reference in New Issue
Block a user