MCPcopy
hub / github.com/daptin/daptin / TestWebSocketDestroySystemTopicError

Function TestWebSocketDestroySystemTopicError

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

Source from the content-addressed store, hash-verified

397}
398
399func TestWebSocketDestroySystemTopicError(t *testing.T) {
400 ensureServer()
401 token := signUpAndGetToken(t)
402
403 ws := dialWS(t, token)
404 defer ws.Close()
405
406 // "world" is always a system topic
407 sendJSON(t, ws, wsPayload{
408 Id: nextReqId(),
409 Method: "destroy-topicName",
410 Payload: map[string]interface{}{"name": "world"},
411 })
412
413 msg := recvJSON(t, ws, 5*time.Second)
414 if msg.Type != "response" || msg.Ok == nil || *msg.Ok {
415 t.Errorf("expected error for system topic delete, got type=%q ok=%v", msg.Type, msg.Ok)
416 }
417}
418
419func TestWebSocketCreateDuplicateTopicError(t *testing.T) {
420 ensureServer()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected