 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>
		
			
				
	
	
		
			81 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| export { getLocalName } from "./getRole.mjs";
 | |
| import getRole, { getLocalName } from "./getRole.mjs";
 | |
| export function isElement(node) {
 | |
|   return node !== null && node.nodeType === node.ELEMENT_NODE;
 | |
| }
 | |
| export function isHTMLTableCaptionElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "caption";
 | |
| }
 | |
| export function isHTMLInputElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "input";
 | |
| }
 | |
| export function isHTMLOptGroupElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "optgroup";
 | |
| }
 | |
| export function isHTMLSelectElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "select";
 | |
| }
 | |
| export function isHTMLTableElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "table";
 | |
| }
 | |
| export function isHTMLTextAreaElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "textarea";
 | |
| }
 | |
| export function safeWindow(node) {
 | |
|   var _ref = node.ownerDocument === null ? node : node.ownerDocument,
 | |
|     defaultView = _ref.defaultView;
 | |
|   if (defaultView === null) {
 | |
|     throw new TypeError("no window available");
 | |
|   }
 | |
|   return defaultView;
 | |
| }
 | |
| export function isHTMLFieldSetElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "fieldset";
 | |
| }
 | |
| export function isHTMLLegendElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "legend";
 | |
| }
 | |
| export function isHTMLSlotElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "slot";
 | |
| }
 | |
| export function isSVGElement(node) {
 | |
|   return isElement(node) && node.ownerSVGElement !== undefined;
 | |
| }
 | |
| export function isSVGSVGElement(node) {
 | |
|   return isElement(node) && getLocalName(node) === "svg";
 | |
| }
 | |
| export function isSVGTitleElement(node) {
 | |
|   return isSVGElement(node) && getLocalName(node) === "title";
 | |
| }
 | |
| 
 | |
| /**
 | |
|  *
 | |
|  * @param {Node} node -
 | |
|  * @param {string} attributeName -
 | |
|  * @returns {Element[]} -
 | |
|  */
 | |
| export function queryIdRefs(node, attributeName) {
 | |
|   if (isElement(node) && node.hasAttribute(attributeName)) {
 | |
|     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check
 | |
|     var ids = node.getAttribute(attributeName).split(" ");
 | |
| 
 | |
|     // Browsers that don't support shadow DOM won't have getRootNode
 | |
|     var root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
 | |
|     return ids.map(function (id) {
 | |
|       return root.getElementById(id);
 | |
|     }).filter(function (element) {
 | |
|       return element !== null;
 | |
|     }
 | |
|     // TODO: why does this not narrow?
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   return [];
 | |
| }
 | |
| export function hasAnyConcreteRoles(node, roles) {
 | |
|   if (isElement(node)) {
 | |
|     return roles.indexOf(getRole(node)) !== -1;
 | |
|   }
 | |
|   return false;
 | |
| }
 | |
| //# sourceMappingURL=util.mjs.map
 |