test: add unit tests for database and Gitea client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
panw
2026-03-31 16:44:43 +08:00
parent 932b367806
commit 6e8cbb38d4
2 changed files with 128 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package gitea
import "testing"
func TestNewClient(t *testing.T) {
client, err := NewClient("https://gitea.com", "")
if err != nil {
t.Fatal(err)
}
if client == nil {
t.Error("client is nil")
}
}
func TestNewClientInvalidURL(t *testing.T) {
_, err := NewClient("://invalid", "")
if err == nil {
t.Error("expected error for invalid URL")
}
}