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:
34
server/internal/pool/proxy_test.go
Normal file
34
server/internal/pool/proxy_test.go
Normal 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"}`),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user