diff --git a/internal/channels/telegram/media_test.go b/internal/channels/telegram/media_test.go index b3c6b9bde..8edd297d2 100644 --- a/internal/channels/telegram/media_test.go +++ b/internal/channels/telegram/media_test.go @@ -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) {