MCPcopy
hub / github.com/tinode/chat / TestHandleMetaChanErr

Function TestHandleMetaChanErr

server/topic_test.go:2479–2511  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2477}
2478
2479func TestHandleMetaChanErr(t *testing.T) {
2480 topicName := "grpTest"
2481 chanName := "chnTest"
2482 numUsers := 3
2483 helper := TopicTestHelper{}
2484 defer helper.tearDown()
2485 helper.setUp(t, numUsers, types.TopicCatGrp, topicName, false)
2486
2487 // This is not a channel. However, we will try to handle an info message where
2488 // the topic is referenced as "chn".
2489 helper.topic.isChan = false
2490 // Empty message since this request should trigger an error anyway.
2491 meta := &ClientComMessage{
2492 AsUser: helper.uids[0].UserId(),
2493 Original: chanName,
2494 MetaWhat: constMsgMetaDesc | constMsgMetaSub | constMsgMetaData | constMsgMetaDel,
2495 sess: helper.sessions[0],
2496 }
2497 helper.topic.handleMeta(meta)
2498 helper.finish()
2499
2500 // Check for errors from testHubLoop
2501 if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError {
2502 t.Fatal(errorMsgs[0].Ctrl.Text)
2503 }
2504
2505 // Session output.
2506 registerSessionVerifyOutputs(t, helper.results[0], []int{http.StatusNotFound})
2507 // Presence notifications.
2508 if len(helper.hubMessages) != 0 {
2509 t.Errorf("Hub messages recipients: expected 0, received %d", len(helper.hubMessages))
2510 }
2511}
2512
2513func TestHandleMetaGet(t *testing.T) {
2514 topicName := "usrMe"

Callers

nothing calls this directly

Calls 6

tearDownMethod · 0.95
setUpMethod · 0.95
finishMethod · 0.95
UserIdMethod · 0.80
handleMetaMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…