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

Function TestDispatchLeaveUnknownTopic

server/session_test.go:411–435  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

409}
410
411func TestDispatchLeaveUnknownTopic(t *testing.T) {
412 uid := types.Uid(1)
413 s := test_makeSession(uid)
414 wg := sync.WaitGroup{}
415 r := responses{}
416 wg.Add(1)
417 go s.testWriteLoop(&r, &wg)
418
419 // Session isn't subscribed to topic 'me'.
420 // And wants to leave it => no change.
421 s.subs = make(map[string]*Subscription)
422
423 msg := &ClientComMessage{
424 Leave: &MsgClientLeave{
425 Id: "123",
426 Topic: "me",
427 },
428 }
429
430 s.dispatch(msg)
431 close(s.send)
432 wg.Wait()
433
434 verifyResponseCodes(&r, []int{http.StatusNotModified}, t)
435}
436
437func TestDispatchLeaveUnsubFromUnknownTopic(t *testing.T) {
438 uid := types.Uid(1)

Callers

nothing calls this directly

Calls 7

UidTypeAlias · 0.92
test_makeSessionFunction · 0.85
verifyResponseCodesFunction · 0.85
testWriteLoopMethod · 0.80
dispatchMethod · 0.80
WaitMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…