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

Function TestUsersForTopic

server/db/rethinkdb/tests/rethink_test.go:463–491  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

461}
462
463func TestUsersForTopic(t *testing.T) {
464 qOpts := types.QueryOpt{
465 User: types.ParseUserId("usr" + testData.Users[0].Id),
466 Limit: 999,
467 }
468 gotSubs, err := adp.UsersForTopic(testData.Topics[0].Id, false, &qOpts)
469 if err != nil {
470 t.Fatal(err)
471 }
472 if len(gotSubs) != 1 {
473 t.Error(mismatchErrorString("Subs length", len(gotSubs), 1))
474 }
475
476 gotSubs, err = adp.UsersForTopic(testData.Topics[0].Id, true, nil)
477 if err != nil {
478 t.Fatal(err)
479 }
480 if len(gotSubs) != 2 {
481 t.Error(mismatchErrorString("Subs length", len(gotSubs), 2))
482 }
483
484 gotSubs, err = adp.UsersForTopic(testData.Topics[1].Id, false, nil)
485 if err != nil {
486 t.Fatal(err)
487 }
488 if len(gotSubs) != 2 {
489 t.Error(mismatchErrorString("Subs length", len(gotSubs), 2))
490 }
491}
492
493func TestOwnTopics(t *testing.T) {
494 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…