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

Function TestTopicUpdateSubCnt

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

Source from the content-addressed store, hash-verified

880}
881
882func TestTopicUpdateSubCnt(t *testing.T) {
883 // Test RethinkDB specific method
884 err := adp.TopicUpdateSubCnt(testData.Topics[0].Id)
885 if err != nil {
886 t.Fatal(err)
887 }
888
889 // Verify the subscription count was updated correctly
890 cursor, err := rdb.Table("topics").Get(testData.Topics[0].Id).Field("SubCnt").Run(conn)
891 if err != nil {
892 t.Fatal(err)
893 }
894 defer cursor.Close()
895
896 var subcnt int
897 if err = cursor.One(&subcnt); err != nil {
898 t.Fatal(err)
899 }
900 // Should match the number of active subscriptions
901 if subcnt < 0 {
902 t.Error("Subscription count should be non-negative")
903 }
904}
905
906func TestTopicOwnerChange(t *testing.T) {
907 err := adp.TopicOwnerChange(testData.Topics[0].Id, types.ParseUserId("usr"+testData.Users[1].Id))

Callers

nothing calls this directly

Calls 4

ErrorMethod · 0.80
TopicUpdateSubCntMethod · 0.65
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…