test(telegram): pin upload-ceiling agreement with send_file
Choice: cross-package test (pin). Both ceiling pairs are live producers and currently agree, so the WIRE/DELETE rule does not apply. Deriving one shared definition would either require a new package outside this lane's ownership or bind the channel-free sendfile tool to the telegram package; the cross-package test pins the documented 'the two must agree' contract at the duplicate itself.
This commit is contained in:
1 parent
b0050ff20a
commit
0c5ea7b2a0
1 file changed
+17
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/gateway"
|
||||
"github.com/samcharles93/archie-core/internal/tools/sendfile"
|
||||
)
|
||||
|
||||
// mediaAPI stands in for the Bot API, recording which sendX method was
|
||||
@@ -450,6 +451,22 @@ func TestSendMedia_LocalPathFailures(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMediaUploadCeilingsAgreeWithSendFile pins the contract documented in
|
||||
// sendfile/tool.go: the send_file early check and this sender's Bot API
|
||||
// ceilings must be the same number, or an oversized file is reported "sent"
|
||||
// by the tool and then silently rejected here -- the exact silent
|
||||
// non-delivery send_file exists to end.
|
||||
func TestMediaUploadCeilingsAgreeWithSendFile(t *testing.T) {
|
||||
if sendfile.MaxImageUploadBytes != maxPhotoUploadBytes {
|
||||
t.Errorf("send_file image ceiling = %d bytes, telegram photo ceiling = %d bytes; they must agree",
|
||||
sendfile.MaxImageUploadBytes, maxPhotoUploadBytes)
|
||||
}
|
||||
if sendfile.MaxUploadBytes != maxFileUploadBytes {
|
||||
t.Errorf("send_file upload ceiling = %d bytes, telegram file ceiling = %d bytes; they must agree",
|
||||
sendfile.MaxUploadBytes, maxFileUploadBytes)
|
||||
}
|
||||
}
|
||||
|
||||
// A photo just under the photo ceiling must still be accepted -- the
|
||||
// per-type limits must not collapse into one conservative number.
|
||||
func TestSendMedia_PhotoUnderLimitIsSent(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user