fix: sync WebA labels and forward fixes

This commit is contained in:
A 2026-07-04 21:14:41 +08:00
parent 7bb7e11603
commit 4d3bbeabd8
11 changed files with 422 additions and 10 deletions

View file

@ -244,6 +244,37 @@ func TestMessageReplyFromInputStorySucceedsAndProjectsStoryHeader(t *testing.T)
}
}
func TestMessageReplyFromInputEmptyMessageIsAbsent(t *testing.T) {
const userID = int64(1000000001)
ctx := WithUserID(context.Background(), userID)
r := New(Config{}, Deps{}, zaptest.NewLogger(t), clock.System)
peer := domain.Peer{Type: domain.PeerTypeUser, ID: 1000000002}
reply, err := r.messageReplyFromInput(ctx, userID, peer, &tg.InputReplyToMessage{})
if err != nil {
t.Fatalf("empty reply err = %v, want nil", err)
}
if reply != nil {
t.Fatalf("empty reply = %+v, want nil", reply)
}
topicReply := &tg.InputReplyToMessage{}
topicReply.SetTopMsgID(123)
reply, err = r.messageReplyFromInput(ctx, userID, peer, topicReply)
if err != nil {
t.Fatalf("topic-only reply err = %v, want nil", err)
}
if reply == nil || reply.MessageID != 0 || reply.TopMessageID != 123 {
t.Fatalf("topic-only reply = %+v, want top_msg_id=123", reply)
}
quoteOnly := &tg.InputReplyToMessage{}
quoteOnly.SetQuoteText("orphan quote")
if _, err := r.messageReplyFromInput(ctx, userID, peer, quoteOnly); err == nil || !strings.Contains(err.Error(), "REPLY_MESSAGE_ID_INVALID") {
t.Fatalf("quote-only reply err = %v, want REPLY_MESSAGE_ID_INVALID", err)
}
}
func TestMessageReplyFromInputUnsupportedShapesReturnExplicitErrors(t *testing.T) {
const userID = int64(1000000001)
ctx := WithUserID(context.Background(), userID)