import { getDatabase } from './src/lib/database/index.js'

async function testDatabase() {
  try {
    console.log('Testing database connection...')
    const db = await getDatabase()
    
    console.log('Creating test user...')
    const user = await db.createUser({
      email: 'test@example.com',
      firstName: 'Test',
      lastName: 'User',
      password: 'hashedpassword',
      role: 'client'
    })
    
    console.log('Created user:', user)
    
    console.log('Getting user by email...')
    const foundUser = await db.getUserByEmail('test@example.com')
    console.log('Found user:', foundUser)
    
    console.log('Database test completed successfully!')
  } catch (error) {
    console.error('Database test failed:', error)
  }
}

testDatabase()