MCPcopy
hub / github.com/daptin/daptin / TestWebSocketRequestCorrelation

Function TestWebSocketRequestCorrelation

websocket_test.go:530–544  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

528}
529
530func TestWebSocketRequestCorrelation(t *testing.T) {
531 ensureServer()
532 token := signUpAndGetToken(t)
533
534 ws := dialWS(t, token)
535 defer ws.Close()
536
537 // send with id — response should echo id
538 id := nextReqId()
539 sendJSON(t, ws, wsPayload{Id: id, Method: "subscribe", Payload: map[string]interface{}{"topicName": "user_account"}})
540 msg := recvJSON(t, ws, 5*time.Second)
541 if msg.Id != id {
542 t.Errorf("expected id=%q echoed, got %q", id, msg.Id)
543 }
544}
545
546func TestWebSocketNoIdOmitted(t *testing.T) {
547 ensureServer()

Callers

nothing calls this directly

Calls 7

ensureServerFunction · 0.85
signUpAndGetTokenFunction · 0.85
dialWSFunction · 0.85
nextReqIdFunction · 0.85
sendJSONFunction · 0.85
recvJSONFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected