(t *testing.T)
| 417 | } |
| 418 | |
| 419 | func TestWebSocketCreateDuplicateTopicError(t *testing.T) { |
| 420 | ensureServer() |
| 421 | token := signUpAndGetToken(t) |
| 422 | |
| 423 | ws := dialWS(t, token) |
| 424 | defer ws.Close() |
| 425 | |
| 426 | topicName := fmt.Sprintf("dup-topic-%d", time.Now().UnixNano()) |
| 427 | |
| 428 | // create first |
| 429 | sendJSON(t, ws, wsPayload{Id: nextReqId(), Method: "create-topicName", Payload: map[string]interface{}{"name": topicName}}) |
| 430 | recvJSON(t, ws, 5*time.Second) // success response |
| 431 | |
| 432 | // create duplicate |
| 433 | sendJSON(t, ws, wsPayload{Id: nextReqId(), Method: "create-topicName", Payload: map[string]interface{}{"name": topicName}}) |
| 434 | msg := recvJSON(t, ws, 5*time.Second) |
| 435 | if msg.Type != "response" || msg.Ok == nil || *msg.Ok { |
| 436 | t.Errorf("expected error for duplicate topic, got type=%q ok=%v", msg.Type, msg.Ok) |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | func TestWebSocketPingPong(t *testing.T) { |
| 441 | ensureServer() |
nothing calls this directly
no test coverage detected