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

Function TestUsersForTopic

server/db/postgres/tests/postgres_test.go:470–498  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

468}
469
470func TestUsersForTopic(t *testing.T) {
471 qOpts := types.QueryOpt{
472 User: types.ParseUserId("usr" + testData.Users[0].Id),
473 Limit: 999,
474 }
475 gotSubs, err := adp.UsersForTopic("grpgRXf0rU4uR4", false, &qOpts)
476 if err != nil {
477 t.Fatal(err)
478 }
479 if len(gotSubs) != 1 {
480 t.Error(mismatchErrorString("Subs length", len(gotSubs), 1))
481 }
482
483 gotSubs, err = adp.UsersForTopic("grpgRXf0rU4uR4", true, nil)
484 if err != nil {
485 t.Fatal(err)
486 }
487 if len(gotSubs) != 2 {
488 t.Error(mismatchErrorString("Subs length", len(gotSubs), 2))
489 }
490
491 gotSubs, err = adp.UsersForTopic("p2p9AVDamaNCRbfKzGSh3mE0w", false, nil)
492 if err != nil {
493 t.Fatal(err)
494 }
495 if len(gotSubs) != 2 {
496 t.Error(mismatchErrorString("Subs length", len(gotSubs), 2))
497 }
498}
499
500func TestOwnTopics(t *testing.T) {
501 gotSubs, err := adp.OwnTopics(types.ParseUserId("usr" + testData.Users[0].Id))

Callers

nothing calls this directly

Calls 4

ParseUserIdFunction · 0.92
ErrorMethod · 0.80
mismatchErrorStringFunction · 0.70
UsersForTopicMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…