mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 19:41:17 +00:00
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
This commit is contained in:
parent
2c561cbea7
commit
96b7370f7b
40 changed files with 5061 additions and 1466 deletions
32
internal/api/config_handlers_setup_code_test.go
Normal file
32
internal/api/config_handlers_setup_code_test.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue