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

Function TestTopicShare

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

Source from the content-addressed store, hash-verified

197}
198
199func TestTopicShare(t *testing.T) {
200 if err := adp.TopicShare(testData.Subs[0].Topic, testData.Subs); err != nil {
201 t.Fatal(err)
202 }
203
204 // Must save recvseqid and readseqid separately because TopicShare
205 // ignores them.
206 for _, sub := range testData.Subs {
207 adp.SubsUpdate(sub.Topic, types.ParseUid(sub.User), map[string]any{
208 "delid": sub.DelId,
209 "recvseqid": sub.RecvSeqId,
210 "readseqid": sub.ReadSeqId,
211 })
212 }
213
214 // Update topic SeqId because it's not saved at creation time but used by the tests.
215 for _, tpc := range testData.Topics {
216 err := adp.TopicUpdate(tpc.Id, map[string]any{
217 "seqid": tpc.SeqId,
218 "delid": tpc.DelId,
219 })
220 if err != nil {
221 t.Error(err)
222 }
223 }
224}
225
226func TestMessageSave(t *testing.T) {
227 for _, msg := range testData.Msgs {

Callers

nothing calls this directly

Calls 5

ParseUidFunction · 0.92
ErrorMethod · 0.80
TopicShareMethod · 0.65
SubsUpdateMethod · 0.65
TopicUpdateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…