Spaces:
Paused
Paused
File size: 1,384 Bytes
c904036 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | /**
* Storage Service Test Script
*
* This script tests the unified storage service functionality
* Run with: node scripts/testStorage.js
*/
require('dotenv').config();
const { unifiedStorageService, getProviderInfo, healthCheck } = require('../Services/driveService');
async function testStorageService() {
console.log('Starting storage service tests...');
try {
// Test 1: Get provider info
const info = getProviderInfo();
// Test 2: Health check
await healthCheck();
// Test 3: Test provider switching (if applicable)
const availableProviders = info.available;
for (const provider of availableProviders) {
try {
unifiedStorageService.switchProvider(provider);
await healthCheck();
} catch (error) {
// Ignore errors during provider switching
}
}
// Switch back to default
const defaultProvider = process.env.STORAGE_PROVIDER || 'local';
unifiedStorageService.switchProvider(defaultProvider);
} catch (error) {
console.error('Storage service test failed:', error);
throw error;
}
}
// Run the test
if (require.main === module) {
testStorageService().then(() => {
process.exit(0);
}).catch((error) => {
console.error('Test script error:', error);
process.exit(1);
});
}
module.exports = { testStorageService };
|