Initial commit: Complete NodeJS-native setup
- Migrated from Python pre-commit to NodeJS-native solution - Reorganized documentation structure - Set up Husky + lint-staged for efficient pre-commit hooks - Fixed Dockerfile healthcheck issue - Added comprehensive documentation index
This commit is contained in:
78
tests/integration/production.test.js
Normal file
78
tests/integration/production.test.js
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
// Production environment test script
|
||||
console.log('🧪 Testing Production Environment...\n');
|
||||
|
||||
// Test 1: Check if CouchDB is accessible
|
||||
console.log('1️⃣ Testing CouchDB connection...');
|
||||
try {
|
||||
const response = await fetch('http://localhost:5984/', {
|
||||
headers: {
|
||||
Authorization: 'Basic ' + btoa('admin:password'),
|
||||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
console.log('✅ CouchDB is accessible');
|
||||
console.log(` Version: ${data.version}`);
|
||||
} else {
|
||||
console.log('❌ CouchDB connection failed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ CouchDB connection error:', error.message);
|
||||
}
|
||||
|
||||
// Test 2: Check if databases exist
|
||||
console.log('\n2️⃣ Checking databases...');
|
||||
try {
|
||||
const response = await fetch('http://localhost:5984/_all_dbs', {
|
||||
headers: {
|
||||
Authorization: 'Basic ' + btoa('admin:password'),
|
||||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const databases = await response.json();
|
||||
console.log('✅ Available databases:', databases);
|
||||
|
||||
const requiredDbs = [
|
||||
'users',
|
||||
'medications',
|
||||
'settings',
|
||||
'taken_doses',
|
||||
'reminders',
|
||||
];
|
||||
const missing = requiredDbs.filter(db => !databases.includes(db));
|
||||
|
||||
if (missing.length === 0) {
|
||||
console.log('✅ All required databases exist');
|
||||
} else {
|
||||
console.log('⚠️ Missing databases:', missing);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ Database check error:', error.message);
|
||||
}
|
||||
|
||||
// Test 3: Check if frontend is accessible
|
||||
console.log('\n3️⃣ Testing frontend accessibility...');
|
||||
try {
|
||||
const response = await fetch('http://localhost:8080/');
|
||||
|
||||
if (response.ok) {
|
||||
console.log('✅ Frontend is accessible at http://localhost:8080');
|
||||
} else {
|
||||
console.log('❌ Frontend connection failed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ Frontend connection error:', error.message);
|
||||
}
|
||||
|
||||
console.log('\n🎯 Production Environment Test Summary:');
|
||||
console.log(' • CouchDB: http://localhost:5984');
|
||||
console.log(' • Frontend: http://localhost:8080');
|
||||
console.log(' • Admin Login: admin@localhost / admin123!');
|
||||
console.log(
|
||||
'\n🚀 Your medication reminder app is ready for production testing!'
|
||||
);
|
||||
Reference in New Issue
Block a user