- 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>
31 lines
1.5 KiB
JavaScript
31 lines
1.5 KiB
JavaScript
import { unsafeUniformIntDistributionInternal } from './internals/UnsafeUniformIntDistributionInternal.js';
|
|
import { fromNumberToArrayInt64, substractArrayInt64 } from './internals/ArrayInt64.js';
|
|
import { unsafeUniformArrayIntDistributionInternal } from './internals/UnsafeUniformArrayIntDistributionInternal.js';
|
|
var safeNumberMaxSafeInteger = Number.MAX_SAFE_INTEGER;
|
|
var sharedA = { sign: 1, data: [0, 0] };
|
|
var sharedB = { sign: 1, data: [0, 0] };
|
|
var sharedC = { sign: 1, data: [0, 0] };
|
|
var sharedData = [0, 0];
|
|
function uniformLargeIntInternal(from, to, rangeSize, rng) {
|
|
var rangeSizeArrayIntValue = rangeSize <= safeNumberMaxSafeInteger
|
|
? fromNumberToArrayInt64(sharedC, rangeSize)
|
|
: substractArrayInt64(sharedC, fromNumberToArrayInt64(sharedA, to), fromNumberToArrayInt64(sharedB, from));
|
|
if (rangeSizeArrayIntValue.data[1] === 0xffffffff) {
|
|
rangeSizeArrayIntValue.data[0] += 1;
|
|
rangeSizeArrayIntValue.data[1] = 0;
|
|
}
|
|
else {
|
|
rangeSizeArrayIntValue.data[1] += 1;
|
|
}
|
|
unsafeUniformArrayIntDistributionInternal(sharedData, rangeSizeArrayIntValue.data, rng);
|
|
return sharedData[0] * 0x100000000 + sharedData[1] + from;
|
|
}
|
|
export function unsafeUniformIntDistribution(from, to, rng) {
|
|
var rangeSize = to - from;
|
|
if (rangeSize <= 0xffffffff) {
|
|
var g = unsafeUniformIntDistributionInternal(rangeSize + 1, rng);
|
|
return g + from;
|
|
}
|
|
return uniformLargeIntInternal(from, to, rangeSize, rng);
|
|
}
|