mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
- 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
33 lines
711 B
Go
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.
|
|
}
|