+1763
tests/integration/comment_consumer_test.go
···
···+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&commentCount)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&initialCount)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&finalCount)+t.Errorf("Comment count should not increase on duplicate event. Initial: %d, Final: %d", initialCount, finalCount)+testPostURI := createTestPost(t, db, testCommunity, testUser.DID, "Threading Test", 0, time.Now())+comment1URI := fmt.Sprintf("at://%s/social.coves.feed.comment/%s", testUser.DID, comment1Rkey)+comment2URI := fmt.Sprintf("at://%s/social.coves.feed.comment/%s", testUser.DID, comment2Rkey)+testPostURI := createTestPost(t, db, testCommunity, testUser.DID, "Delete Test", 0, time.Now())+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&initialCount)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&finalCount)+t.Errorf("Expected comment count to decrease by 1. Initial: %d, Final: %d", initialCount, finalCount)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&countAfterFirstDelete)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", testPostURI).Scan(&countAfterSecondDelete)+t.Errorf("Count should not change on duplicate delete. After first: %d, After second: %d", countAfterFirstDelete, countAfterSecondDelete)+testPostURI := createTestPost(t, db, testCommunity, testUser.DID, "Security Test", 0, time.Now())+postURI := createTestPost(t, db, testCommunity, testUser.DID, "OOO Test Post", 0, time.Now())+t.Errorf("Expected parent reply_count to be 1 (reconciled), got %d", parentComment.ReplyCount)+t.Errorf("Expected parent reply_count to be 3 (reconciled), got %d", parentComment.ReplyCount)+postURI := createTestPost(t, db, testCommunity, testUser.DID, "Resurrection Test", 0, time.Now())+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", postURI).Scan(&postCommentCount)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", post1URI).Scan(&post1Count)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", post1URI).Scan(&post1Count)+t.Errorf("Expected parent URI to be %s (Post 2), got %s (STALE!)", post2URI, comment.ParentURI)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", post2URI).Scan(&post2Count)+err = db.QueryRowContext(ctx, "SELECT comment_count FROM posts WHERE uri = $1", post1URI).Scan(&post1Count)+// TestCommentConsumer_ThreadingImmutability tests that UPDATE events cannot change threading refs