Files
Pulse/internal/api/config_handlers_setup_code_test.go
rcourtman 96b7370f7b test: improve coverage for API, AI, Alerts, and Frontend Utils
- Add comprehensive tests for internal/api/config_handlers.go (Phases 1-3)
- Improve test coverage for AI tools, chat service, and session management
- Enhance alert and notification tests (ResolvedAlert, Webhook)
- Add frontend unit tests for utils (searchHistory, tagColors, temperature, url)
- Add proximity client API tests
2026-01-20 15:52:39 +00:00

33 lines
711 B
Go

package api
import (
"testing"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
)
func TestGenerateSetupCode(t *testing.T) {
tempDir := t.TempDir()
cfg := &config.Config{
DataPath: tempDir,
ConfigPath: tempDir,
}
handler := newTestConfigHandlers(t, cfg)
// Test 1: Basic generation
code := handler.generateSetupCode()
if len(code) != 32 { // 16 bytes hex encoded = 32 chars
t.Errorf("expected code length 32, got %d", len(code))
}
// Verify uniqueness
code2 := handler.generateSetupCode()
if code == code2 {
t.Error("generated codes should be unique (random)")
}
// Storage is handled by HandleSetupScriptURL, not generateSetupCode.
// So we don't verify storage here.
}