MCPcopy Index your code
hub / github.com/tinode/chat / TestTopicUpdateOnMessage

Function TestTopicUpdateOnMessage

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

Source from the content-addressed store, hash-verified

818}
819
820func TestTopicUpdateOnMessage(t *testing.T) {
821 msg := types.Message{
822 ObjHeader: types.ObjHeader{
823 CreatedAt: testData.Now.Add(33 * time.Minute),
824 },
825 SeqId: 66,
826 }
827 err := adp.TopicUpdateOnMessage(testData.Topics[2].Id, &msg)
828 if err != nil {
829 t.Fatal(err)
830 }
831 var got struct {
832 TouchedAt time.Time
833 SeqId int
834 }
835 err = db.QueryRow(ctx, "SELECT touchedat, seqid FROM topics WHERE name=$1", testData.Topics[2].Id).
836 Scan(&got.TouchedAt, &got.SeqId)
837 if err != nil {
838 t.Fatal(err)
839 }
840 if got.TouchedAt != msg.CreatedAt || got.SeqId != msg.SeqId {
841 t.Error(mismatchErrorString("TouchedAt", got.TouchedAt, msg.CreatedAt))
842 t.Error(mismatchErrorString("SeqId", got.SeqId, msg.SeqId))
843 }
844}
845
846func TestTopicUpdate(t *testing.T) {
847 update := map[string]any{

Callers

nothing calls this directly

Calls 5

ErrorMethod · 0.80
mismatchErrorStringFunction · 0.70
TopicUpdateOnMessageMethod · 0.65
AddMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…