- 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>
114 lines
2.4 KiB
JavaScript
114 lines
2.4 KiB
JavaScript
|
|
namespace('concurrent', function () {
|
|
task('A', function () {
|
|
console.log('Started A');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Finished A');
|
|
resolve();
|
|
}, 200);
|
|
});
|
|
});
|
|
|
|
task('B', function () {
|
|
console.log('Started B');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Finished B');
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('C', function () {
|
|
console.log('Started C');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Finished C');
|
|
resolve();
|
|
}, 100);
|
|
});
|
|
});
|
|
|
|
task('D', function () {
|
|
console.log('Started D');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Finished D');
|
|
resolve();
|
|
}, 300);
|
|
});
|
|
});
|
|
|
|
task('Ba', ['A'], function () {
|
|
console.log('Started Ba');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Finished Ba');
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('Afail', function () {
|
|
console.log('Started failing task');
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
console.log('Failing B with error');
|
|
throw new Error('I failed');
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('simple1', ['A','B'], {concurrency: 2}, function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('simple2', ['C','D'], {concurrency: 2}, function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('seqconcurrent', ['simple1','simple2'], function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('concurrentconcurrent', ['simple1','simple2'], {concurrency: 2}, function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('subdep', ['A','Ba'], {concurrency: 2}, function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
task('fail', ['A', 'B', 'Afail'], {concurrency: 3}, function () {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, 50);
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|