#!/usr/bin/env node /** * WebDAV Integration Test * * This script tests the WebDAV service integration with a sample Nextcloud instance. * Update the configuration below to match your Nextcloud setup. */ import { WebDAVService } from './dist/services/webdavService.js'; // Test configuration - update these values for your Nextcloud instance const testConfig = { provider: 'webdav', url: 'https://your-nextcloud.com/remote.php/dav/files/username/', username: 'your-username', password: 'your-password-or-app-password', basePath: '/music-files' }; async function testWebDAVConnection() { console.log('๐Ÿงช Testing WebDAV connection...'); console.log('๐Ÿ“‹ Configuration:', { ...testConfig, password: '***' // Hide password in logs }); try { // Create WebDAV service const webdavService = new WebDAVService(testConfig); // Test connection console.log('๐Ÿ”— Testing connection...'); const isConnected = await webdavService.testConnection(); if (isConnected) { console.log('โœ… WebDAV connection successful!'); // Test listing files console.log('๐Ÿ“ Testing file listing...'); const files = await webdavService.listAllFiles(); console.log(`๐Ÿ“Š Found ${files.length} files`); // Test listing folders console.log('๐Ÿ“‚ Testing folder listing...'); const folders = await webdavService.listAllFolders(); console.log(`๐Ÿ“Š Found ${folders.length} folders:`, folders); console.log('๐ŸŽ‰ All WebDAV tests passed!'); } else { console.log('โŒ WebDAV connection failed'); } } catch (error) { console.error('โŒ WebDAV test failed:', error.message); console.error('๐Ÿ’ก Make sure to update the configuration in this file with your Nextcloud details'); } } // Run the test testWebDAVConnection().catch(console.error);