chore: refresh gramsrv public release
This commit is contained in:
parent
75cebe8dbf
commit
70b6820474
1274 changed files with 378751 additions and 59919 deletions
39
internal/rpc/message_grouped_projection_test.go
Normal file
39
internal/rpc/message_grouped_projection_test.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
// TestMessageGroupedIDProjection 验证相册 grouped_id 投影到 tg.Message(私聊+频道),
|
||||
// 0 值不下发(flag-optional),非零下发。
|
||||
func TestMessageGroupedIDProjection(t *testing.T) {
|
||||
const groupedID = int64(880000000123)
|
||||
|
||||
priv := tgMessage(domain.Message{
|
||||
ID: 5,
|
||||
Peer: domain.Peer{Type: domain.PeerTypeUser, ID: 1002},
|
||||
GroupedID: groupedID,
|
||||
}).(*tg.Message)
|
||||
if got, ok := priv.GetGroupedID(); !ok || got != groupedID {
|
||||
t.Fatalf("private grouped_id = %d ok %v, want %d", got, ok, groupedID)
|
||||
}
|
||||
|
||||
plain := tgMessage(domain.Message{ID: 6, Peer: domain.Peer{Type: domain.PeerTypeUser, ID: 1002}}).(*tg.Message)
|
||||
if _, ok := plain.GetGroupedID(); ok {
|
||||
t.Fatal("non-album private message must not carry grouped_id")
|
||||
}
|
||||
|
||||
ch := tgChannelMessage(1001, domain.ChannelMessage{
|
||||
ChannelID: 2000,
|
||||
ID: 7,
|
||||
From: domain.Peer{Type: domain.PeerTypeUser, ID: 1001},
|
||||
GroupedID: groupedID,
|
||||
}).(*tg.Message)
|
||||
if got, ok := ch.GetGroupedID(); !ok || got != groupedID {
|
||||
t.Fatalf("channel grouped_id = %d ok %v, want %d", got, ok, groupedID)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue