sneeuwvlok/packages/arrtrix/pkg/runtime/main_test.go
Chris Kruining fe627f3aab
Add Arrtrix runtime, config, onboarding, and webhook support
- Implement runtime package for bridge startup, config loading, and env
  overrides
- Add onboarding package for management room welcome messages
- Add matrixcmd package for command processing and help
- Add webhook package with Radarr webhook support and validation
- Extend connector config for webhooks and validation
- Update default config and example config for new options
- Add tests for new packages and config validation
- Change database type default to sqlite3-fk-wal
2026-04-16 09:06:57 +02:00

30 lines
880 B
Go

package runtime
import (
"os"
"path/filepath"
"testing"
"maunium.net/go/mautrix/bridgev2/bridgeconfig"
)
func TestLoadRegistrationTokens(t *testing.T) {
tempDir := t.TempDir()
registrationPath := filepath.Join(tempDir, "registration.yaml")
if err := os.WriteFile(registrationPath, []byte("as_token: app-token\nhs_token: hs-token\n"), 0o600); err != nil {
t.Fatalf("failed to write registration file: %v", err)
}
cfg := &bridgeconfig.Config{}
main := &Main{RegistrationPath: registrationPath}
if err := main.loadRegistrationTokens(cfg); err != nil {
t.Fatalf("loadRegistrationTokens returned error: %v", err)
}
if cfg.AppService.ASToken != "app-token" {
t.Fatalf("expected as token to be loaded, got %q", cfg.AppService.ASToken)
}
if cfg.AppService.HSToken != "hs-token" {
t.Fatalf("expected hs token to be loaded, got %q", cfg.AppService.HSToken)
}
}