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

Function TestTopicUpdateSubCnt

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

Source from the content-addressed store, hash-verified

862}
863
864func TestTopicUpdateSubCnt(t *testing.T) {
865 // Test PostgreSQL specific method
866 err := adp.TopicUpdateSubCnt(testData.Topics[0].Id)
867 if err != nil {
868 t.Fatal(err)
869 }
870
871 // Verify the subscription count was updated correctly
872 var subcnt int
873 err = db.QueryRow(ctx, "SELECT subcnt FROM topics WHERE name=$1", testData.Topics[0].Id).Scan(&subcnt)
874 if err != nil {
875 t.Fatal(err)
876 }
877 // Should match the number of active subscriptions
878 if subcnt < 0 {
879 t.Error("Subscription count should be non-negative")
880 }
881}
882
883func TestTopicOwnerChange(t *testing.T) {
884 err := adp.TopicOwnerChange(testData.Topics[0].Id, types.ParseUserId("usr"+testData.Users[1].Id))

Callers

nothing calls this directly

Calls 3

ErrorMethod · 0.80
TopicUpdateSubCntMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…