Files
AetherForge/server/internal/pool/proxy_test.go
drjones e55f11a657 Add full test suite with unit, integration, and E2E smoke tests.
Introduce test.bat orchestrating Go/Vitest/Playwright phases, expand coverage across server, agent, and dashboard, and document in tests/README.md.
2026-05-29 10:04:52 -07:00

35 lines
897 B
Go

package pool
import (
"testing"
)
func TestAuthenticateSetsLoginRequestID(t *testing.T) {
p := &Proxy{
config: &Config{Wallet: "48test", Password: "x"},
stopCh: make(chan struct{}),
}
// authenticate will fail without real conn, but should bump loginRequestID before write fails
_ = p.authenticate()
if p.loginRequestID != 1 {
t.Fatalf("expected loginRequestID=1, got %d", p.loginRequestID)
}
_ = p.authenticate()
if p.loginRequestID != 2 {
t.Fatalf("expected loginRequestID=2 after second login, got %d", p.loginRequestID)
}
}
func TestHandleResponseLoginByTrackedID(t *testing.T) {
p := &Proxy{
config: &Config{Wallet: "48test"},
stopCh: make(chan struct{}),
loginRequestID: 42,
}
// Should not panic; login branch taken when ID matches
p.handleResponse(StratumResponse{
ID: 42,
Result: []byte(`{"id":"pool-session","status":"OK"}`),
})
}