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

Function TestTopicUpdateOnMessage

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

Source from the content-addressed store, hash-verified

824}
825
826func TestTopicUpdateOnMessage(t *testing.T) {
827 msg := types.Message{
828 ObjHeader: types.ObjHeader{
829 CreatedAt: testData.Now.Add(33 * time.Minute),
830 },
831 SeqId: 66,
832 }
833 err := adp.TopicUpdateOnMessage(testData.Topics[2].Id, &msg)
834 if err != nil {
835 t.Fatal(err)
836 }
837
838 cursor, err := rdb.Table("topics").Get(testData.Topics[2].Id).
839 Pluck("TouchedAt", "SeqId").Run(conn)
840 if err != nil {
841 t.Fatal(err)
842 }
843 defer cursor.Close()
844
845 var got struct {
846 TouchedAt time.Time
847 SeqId int
848 }
849 if err = cursor.One(&got); err != nil {
850 t.Fatal(err)
851 }
852 if !got.TouchedAt.Equal(msg.CreatedAt) || got.SeqId != msg.SeqId {
853 t.Error(mismatchErrorString("TouchedAt", got.TouchedAt, msg.CreatedAt))
854 t.Error(mismatchErrorString("SeqId", got.SeqId, msg.SeqId))
855 }
856}
857
858func TestTopicUpdate(t *testing.T) {
859 update := map[string]any{

Callers

nothing calls this directly

Calls 6

ErrorMethod · 0.80
mismatchErrorStringFunction · 0.70
TopicUpdateOnMessageMethod · 0.65
GetMethod · 0.65
CloseMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…