 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>
		
			
				
	
	
		
			36 lines
		
	
	
		
			953 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			953 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * ...something resembling a binary search, to find the lowest line within the range.
 | |
|  * And then you could break as soon as the line is longer than the range...
 | |
|  */
 | |
| module.exports.sliceRange = (lines, startCol, endCol, inclusive = false) => {
 | |
|   let start = 0
 | |
|   let end = lines.length
 | |
| 
 | |
|   if (inclusive) {
 | |
|     // I consider this a temporary solution until I find an alternaive way to fix the "off by one issue"
 | |
|     --startCol
 | |
|   }
 | |
| 
 | |
|   while (start < end) {
 | |
|     let mid = (start + end) >> 1
 | |
|     if (startCol >= lines[mid].endCol) {
 | |
|       start = mid + 1
 | |
|     } else if (endCol < lines[mid].startCol) {
 | |
|       end = mid - 1
 | |
|     } else {
 | |
|       end = mid
 | |
|       while (mid >= 0 && startCol < lines[mid].endCol && endCol >= lines[mid].startCol) {
 | |
|         --mid
 | |
|       }
 | |
|       start = mid + 1
 | |
|       break
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   while (end < lines.length && startCol < lines[end].endCol && endCol >= lines[end].startCol) {
 | |
|     ++end
 | |
|   }
 | |
| 
 | |
|   return lines.slice(start, end)
 | |
| }
 |