feat: add test connection functionality for proxy hosts and enhance UI for testing connections

This commit is contained in:
Wikid82
2025-11-21 18:06:48 -05:00
parent b3c56529a6
commit 870af044f8
15 changed files with 501 additions and 17 deletions

View File

@@ -1,22 +1,29 @@
package database
import (
"path/filepath"
"testing"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
)
func TestConnect(t *testing.T) {
// Test with memory DB
db, err := Connect("file::memory:?cache=shared")
assert.NoError(t, err)
assert.NotNil(t, db)
// Test with memory DB
db, err := Connect("file::memory:?cache=shared")
assert.NoError(t, err)
assert.NotNil(t, db)
// Test with file DB
tempDir := t.TempDir()
dbPath := filepath.Join(tempDir, "test.db")
db, err = Connect(dbPath)
assert.NoError(t, err)
assert.NotNil(t, db)
// Test with file DB
tempDir := t.TempDir()
dbPath := filepath.Join(tempDir, "test.db")
db, err = Connect(dbPath)
assert.NoError(t, err)
assert.NotNil(t, db)
}
func TestConnect_Error(t *testing.T) {
// Test with invalid path (directory)
tempDir := t.TempDir()
_, err := Connect(tempDir)
assert.Error(t, err)
}