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.
This commit is contained in:
drjones
2026-05-29 10:04:52 -07:00
parent f9e26bb1a6
commit e55f11a657
23 changed files with 1052 additions and 12 deletions

View File

@@ -0,0 +1,34 @@
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"}`),
})
}