first commit
This commit is contained in:
32
internal/config/validate_test.go
Normal file
32
internal/config/validate_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidate_Defaults(t *testing.T) {
|
||||
c := &Config{
|
||||
Domain: "azzamo.net",
|
||||
Port: 8080,
|
||||
AdminAPIKey: "long-secret-key-for-tests",
|
||||
DatabasePath: ".data/nip05.db",
|
||||
}
|
||||
if err := Validate(c); err != nil {
|
||||
t.Fatalf("expected ok, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidate_MissingDomain(t *testing.T) {
|
||||
c := &Config{Port: 8080, AdminAPIKey: "long", DatabasePath: ".data/nip05.db"}
|
||||
if err := Validate(c); err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidate_LightningRequiresLNbits(t *testing.T) {
|
||||
c := &Config{
|
||||
Domain: "azzamo.net", Port: 8080, AdminAPIKey: "long", DatabasePath: ".data/nip05.db",
|
||||
Lightning: LightningConfig{Enabled: true},
|
||||
}
|
||||
if err := Validate(c); err == nil {
|
||||
t.Fatal("expected error for missing LNBITS_URL")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user