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

Function TestDispatchAlreadySubscribed

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

Source from the content-addressed store, hash-verified

269}
270
271func TestDispatchAlreadySubscribed(t *testing.T) {
272 uid := types.Uid(1)
273 s := test_makeSession(uid)
274 wg := sync.WaitGroup{}
275 r := responses{}
276 wg.Add(1)
277 go s.testWriteLoop(&r, &wg)
278
279 msg := &ClientComMessage{
280 Sub: &MsgClientSub{
281 Id: "123",
282 Topic: "me",
283 Get: &MsgGetQuery{
284 What: "sub desc tags cred",
285 },
286 },
287 }
288 // Pretend the session's already subscribed to topic 'me'.
289 s.subs = make(map[string]*Subscription)
290 s.subs[uid.UserId()] = &Subscription{}
291
292 s.dispatch(msg)
293 close(s.send)
294 wg.Wait()
295
296 verifyResponseCodes(&r, []int{http.StatusNotModified}, t)
297}
298
299func TestDispatchSubscribeJoinChannelFull(t *testing.T) {
300 uid := types.Uid(1)

Callers

nothing calls this directly

Calls 8

UidTypeAlias · 0.92
test_makeSessionFunction · 0.85
verifyResponseCodesFunction · 0.85
testWriteLoopMethod · 0.80
UserIdMethod · 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…