(t *testing.T)
| 507 | } |
| 508 | |
| 509 | func TestWebSocketNoSuchMethod(t *testing.T) { |
| 510 | ensureServer() |
| 511 | token := signUpAndGetToken(t) |
| 512 | |
| 513 | ws := dialWS(t, token) |
| 514 | defer ws.Close() |
| 515 | |
| 516 | id := nextReqId() |
| 517 | sendJSON(t, ws, wsPayload{Id: id, Method: "nonexistent-method", Payload: map[string]interface{}{}}) |
| 518 | msg := recvJSON(t, ws, 5*time.Second) |
| 519 | if msg.Type != "response" || msg.Ok == nil || *msg.Ok { |
| 520 | t.Errorf("expected error for unknown method, got type=%q ok=%v", msg.Type, msg.Ok) |
| 521 | } |
| 522 | if msg.Error != "no such method" { |
| 523 | t.Errorf("expected error='no such method', got %q", msg.Error) |
| 524 | } |
| 525 | if msg.Method != "nonexistent-method" { |
| 526 | t.Errorf("expected method echoed back, got %q", msg.Method) |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | func TestWebSocketRequestCorrelation(t *testing.T) { |
| 531 | ensureServer() |
nothing calls this directly
no test coverage detected