MCPcopy Index your code
hub / github.com/tinode/chat / TestHandleSessionUpdateSessToForeground

Function TestHandleSessionUpdateSessToForeground

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

Source from the content-addressed store, hash-verified

2670}
2671
2672func TestHandleSessionUpdateSessToForeground(t *testing.T) {
2673 topicName := "usrMe"
2674 numUsers := 1
2675 helper := TopicTestHelper{}
2676 helper.setUp(t, numUsers, types.TopicCatMe, topicName /*attach=*/, true)
2677 defer helper.tearDown()
2678
2679 uid := helper.uids[0]
2680 supd := &sessionUpdate{
2681 sess: helper.sessions[0],
2682 }
2683 var uaAgent string
2684 helper.topic.handleSessionUpdate(supd, &uaAgent, nil)
2685 helper.finish()
2686
2687 // Check for errors from testHubLoop
2688 if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError {
2689 t.Fatal(errorMsgs[0].Ctrl.Text)
2690 }
2691
2692 // Expect online count bumped up to 2.
2693 if online := helper.topic.perUser[uid].online; online != 2 {
2694 t.Errorf("online count for %s: expected 2, found %d", uid.UserId(), online)
2695 }
2696}
2697
2698func TestHandleSessionUpdateUserAgent(t *testing.T) {
2699 topicName := "usrMe"

Callers

nothing calls this directly

Calls 5

setUpMethod · 0.95
tearDownMethod · 0.95
finishMethod · 0.95
handleSessionUpdateMethod · 0.80
UserIdMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…