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:
anthonyrawlins
2025-07-11 14:06:34 +10:00
parent c6d69695a8
commit aacb45156b
6109 changed files with 777927 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateN = generateN;
var UnsafeGenerateN_1 = require("./UnsafeGenerateN");
function generateN(rng, num) {
var nextRng = rng.clone();
var out = (0, UnsafeGenerateN_1.unsafeGenerateN)(nextRng, num);
return [out, nextRng];
}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.skipN = skipN;
var UnsafeSkipN_1 = require("./UnsafeSkipN");
function skipN(rng, num) {
var nextRng = rng.clone();
(0, UnsafeSkipN_1.unsafeSkipN)(nextRng, num);
return nextRng;
}

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uniformArrayIntDistribution = uniformArrayIntDistribution;
var UnsafeUniformArrayIntDistribution_1 = require("./UnsafeUniformArrayIntDistribution");
function uniformArrayIntDistribution(from, to, rng) {
if (rng != null) {
var nextRng = rng.clone();
return [(0, UnsafeUniformArrayIntDistribution_1.unsafeUniformArrayIntDistribution)(from, to, nextRng), nextRng];
}
return function (rng) {
var nextRng = rng.clone();
return [(0, UnsafeUniformArrayIntDistribution_1.unsafeUniformArrayIntDistribution)(from, to, nextRng), nextRng];
};
}

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uniformBigIntDistribution = uniformBigIntDistribution;
var UnsafeUniformBigIntDistribution_1 = require("./UnsafeUniformBigIntDistribution");
function uniformBigIntDistribution(from, to, rng) {
if (rng != null) {
var nextRng = rng.clone();
return [(0, UnsafeUniformBigIntDistribution_1.unsafeUniformBigIntDistribution)(from, to, nextRng), nextRng];
}
return function (rng) {
var nextRng = rng.clone();
return [(0, UnsafeUniformBigIntDistribution_1.unsafeUniformBigIntDistribution)(from, to, nextRng), nextRng];
};
}

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uniformIntDistribution = uniformIntDistribution;
var UnsafeUniformIntDistribution_1 = require("./UnsafeUniformIntDistribution");
function uniformIntDistribution(from, to, rng) {
if (rng != null) {
var nextRng = rng.clone();
return [(0, UnsafeUniformIntDistribution_1.unsafeUniformIntDistribution)(from, to, nextRng), nextRng];
}
return function (rng) {
var nextRng = rng.clone();
return [(0, UnsafeUniformIntDistribution_1.unsafeUniformIntDistribution)(from, to, nextRng), nextRng];
};
}

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeGenerateN = unsafeGenerateN;
function unsafeGenerateN(rng, num) {
var out = [];
for (var idx = 0; idx != num; ++idx) {
out.push(rng.unsafeNext());
}
return out;
}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeSkipN = unsafeSkipN;
function unsafeSkipN(rng, num) {
for (var idx = 0; idx != num; ++idx) {
rng.unsafeNext();
}
}

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeUniformArrayIntDistribution = unsafeUniformArrayIntDistribution;
var ArrayInt_1 = require("./internals/ArrayInt");
var UnsafeUniformArrayIntDistributionInternal_1 = require("./internals/UnsafeUniformArrayIntDistributionInternal");
function unsafeUniformArrayIntDistribution(from, to, rng) {
var rangeSize = (0, ArrayInt_1.trimArrayIntInplace)((0, ArrayInt_1.addOneToPositiveArrayInt)((0, ArrayInt_1.substractArrayIntToNew)(to, from)));
var emptyArrayIntData = rangeSize.data.slice(0);
var g = (0, UnsafeUniformArrayIntDistributionInternal_1.unsafeUniformArrayIntDistributionInternal)(emptyArrayIntData, rangeSize.data, rng);
return (0, ArrayInt_1.trimArrayIntInplace)((0, ArrayInt_1.addArrayIntToNew)({ sign: 1, data: g }, from));
}

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeUniformBigIntDistribution = unsafeUniformBigIntDistribution;
var SBigInt = typeof BigInt !== 'undefined' ? BigInt : undefined;
var One = typeof BigInt !== 'undefined' ? BigInt(1) : undefined;
var ThirtyTwo = typeof BigInt !== 'undefined' ? BigInt(32) : undefined;
var NumValues = typeof BigInt !== 'undefined' ? BigInt(0x100000000) : undefined;
function unsafeUniformBigIntDistribution(from, to, rng) {
var diff = to - from + One;
var FinalNumValues = NumValues;
var NumIterations = 1;
while (FinalNumValues < diff) {
FinalNumValues <<= ThirtyTwo;
++NumIterations;
}
var value = generateNext(NumIterations, rng);
if (value < diff) {
return value + from;
}
if (value + diff < FinalNumValues) {
return (value % diff) + from;
}
var MaxAcceptedRandom = FinalNumValues - (FinalNumValues % diff);
while (value >= MaxAcceptedRandom) {
value = generateNext(NumIterations, rng);
}
return (value % diff) + from;
}
function generateNext(NumIterations, rng) {
var value = SBigInt(rng.unsafeNext() + 0x80000000);
for (var num = 1; num < NumIterations; ++num) {
var out = rng.unsafeNext();
value = (value << ThirtyTwo) + SBigInt(out + 0x80000000);
}
return value;
}

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeUniformIntDistribution = unsafeUniformIntDistribution;
var UnsafeUniformIntDistributionInternal_1 = require("./internals/UnsafeUniformIntDistributionInternal");
var ArrayInt64_1 = require("./internals/ArrayInt64");
var UnsafeUniformArrayIntDistributionInternal_1 = require("./internals/UnsafeUniformArrayIntDistributionInternal");
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
? (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedC, rangeSize)
: (0, ArrayInt64_1.substractArrayInt64)(sharedC, (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedA, to), (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedB, from));
if (rangeSizeArrayIntValue.data[1] === 0xffffffff) {
rangeSizeArrayIntValue.data[0] += 1;
rangeSizeArrayIntValue.data[1] = 0;
}
else {
rangeSizeArrayIntValue.data[1] += 1;
}
(0, UnsafeUniformArrayIntDistributionInternal_1.unsafeUniformArrayIntDistributionInternal)(sharedData, rangeSizeArrayIntValue.data, rng);
return sharedData[0] * 0x100000000 + sharedData[1] + from;
}
function unsafeUniformIntDistribution(from, to, rng) {
var rangeSize = to - from;
if (rangeSize <= 0xffffffff) {
var g = (0, UnsafeUniformIntDistributionInternal_1.unsafeUniformIntDistributionInternal)(rangeSize + 1, rng);
return g + from;
}
return uniformLargeIntInternal(from, to, rangeSize, rng);
}

View File

@@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addArrayIntToNew = addArrayIntToNew;
exports.addOneToPositiveArrayInt = addOneToPositiveArrayInt;
exports.substractArrayIntToNew = substractArrayIntToNew;
exports.trimArrayIntInplace = trimArrayIntInplace;
function addArrayIntToNew(arrayIntA, arrayIntB) {
if (arrayIntA.sign !== arrayIntB.sign) {
return substractArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
}
var data = [];
var reminder = 0;
var dataA = arrayIntA.data;
var dataB = arrayIntB.data;
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
var vA = indexA >= 0 ? dataA[indexA] : 0;
var vB = indexB >= 0 ? dataB[indexB] : 0;
var current = vA + vB + reminder;
data.push(current >>> 0);
reminder = ~~(current / 0x100000000);
}
if (reminder !== 0) {
data.push(reminder);
}
return { sign: arrayIntA.sign, data: data.reverse() };
}
function addOneToPositiveArrayInt(arrayInt) {
arrayInt.sign = 1;
var data = arrayInt.data;
for (var index = data.length - 1; index >= 0; --index) {
if (data[index] === 0xffffffff) {
data[index] = 0;
}
else {
data[index] += 1;
return arrayInt;
}
}
data.unshift(1);
return arrayInt;
}
function isStrictlySmaller(dataA, dataB) {
var maxLength = Math.max(dataA.length, dataB.length);
for (var index = 0; index < maxLength; ++index) {
var indexA = index + dataA.length - maxLength;
var indexB = index + dataB.length - maxLength;
var vA = indexA >= 0 ? dataA[indexA] : 0;
var vB = indexB >= 0 ? dataB[indexB] : 0;
if (vA < vB)
return true;
if (vA > vB)
return false;
}
return false;
}
function substractArrayIntToNew(arrayIntA, arrayIntB) {
if (arrayIntA.sign !== arrayIntB.sign) {
return addArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
}
var dataA = arrayIntA.data;
var dataB = arrayIntB.data;
if (isStrictlySmaller(dataA, dataB)) {
var out = substractArrayIntToNew(arrayIntB, arrayIntA);
out.sign = -out.sign;
return out;
}
var data = [];
var reminder = 0;
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
var vA = indexA >= 0 ? dataA[indexA] : 0;
var vB = indexB >= 0 ? dataB[indexB] : 0;
var current = vA - vB - reminder;
data.push(current >>> 0);
reminder = current < 0 ? 1 : 0;
}
return { sign: arrayIntA.sign, data: data.reverse() };
}
function trimArrayIntInplace(arrayInt) {
var data = arrayInt.data;
var firstNonZero = 0;
for (; firstNonZero !== data.length && data[firstNonZero] === 0; ++firstNonZero) { }
if (firstNonZero === data.length) {
arrayInt.sign = 1;
arrayInt.data = [0];
return arrayInt;
}
data.splice(0, firstNonZero);
return arrayInt;
}

View File

@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromNumberToArrayInt64 = fromNumberToArrayInt64;
exports.substractArrayInt64 = substractArrayInt64;
function fromNumberToArrayInt64(out, n) {
if (n < 0) {
var posN = -n;
out.sign = -1;
out.data[0] = ~~(posN / 0x100000000);
out.data[1] = posN >>> 0;
}
else {
out.sign = 1;
out.data[0] = ~~(n / 0x100000000);
out.data[1] = n >>> 0;
}
return out;
}
function substractArrayInt64(out, arrayIntA, arrayIntB) {
var lowA = arrayIntA.data[1];
var highA = arrayIntA.data[0];
var signA = arrayIntA.sign;
var lowB = arrayIntB.data[1];
var highB = arrayIntB.data[0];
var signB = arrayIntB.sign;
out.sign = 1;
if (signA === 1 && signB === -1) {
var low_1 = lowA + lowB;
var high = highA + highB + (low_1 > 0xffffffff ? 1 : 0);
out.data[0] = high >>> 0;
out.data[1] = low_1 >>> 0;
return out;
}
var lowFirst = lowA;
var highFirst = highA;
var lowSecond = lowB;
var highSecond = highB;
if (signA === -1) {
lowFirst = lowB;
highFirst = highB;
lowSecond = lowA;
highSecond = highA;
}
var reminderLow = 0;
var low = lowFirst - lowSecond;
if (low < 0) {
reminderLow = 1;
low = low >>> 0;
}
out.data[0] = highFirst - highSecond - reminderLow;
out.data[1] = low;
return out;
}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeUniformArrayIntDistributionInternal = unsafeUniformArrayIntDistributionInternal;
var UnsafeUniformIntDistributionInternal_1 = require("./UnsafeUniformIntDistributionInternal");
function unsafeUniformArrayIntDistributionInternal(out, rangeSize, rng) {
var rangeLength = rangeSize.length;
while (true) {
for (var index = 0; index !== rangeLength; ++index) {
var indexRangeSize = index === 0 ? rangeSize[0] + 1 : 0x100000000;
var g = (0, UnsafeUniformIntDistributionInternal_1.unsafeUniformIntDistributionInternal)(indexRangeSize, rng);
out[index] = g;
}
for (var index = 0; index !== rangeLength; ++index) {
var current = out[index];
var currentInRange = rangeSize[index];
if (current < currentInRange) {
return out;
}
else if (current > currentInRange) {
break;
}
}
}
}

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsafeUniformIntDistributionInternal = unsafeUniformIntDistributionInternal;
function unsafeUniformIntDistributionInternal(rangeSize, rng) {
var MaxAllowed = rangeSize > 2 ? ~~(0x100000000 / rangeSize) * rangeSize : 0x100000000;
var deltaV = rng.unsafeNext() + 0x80000000;
while (deltaV >= MaxAllowed) {
deltaV = rng.unsafeNext() + 0x80000000;
}
return deltaV % rangeSize;
}