util_test.go 476 B

12345678910111213141516171819
  1. package server
  2. import (
  3. "github.com/stretchr/testify/require"
  4. "testing"
  5. )
  6. func TestMaybePeakAttachmentURL_Success(t *testing.T) {
  7. m := &message{
  8. Attachment: &attachment{
  9. URL: "https://ntfy.sh/static/img/ntfy.png",
  10. },
  11. }
  12. require.Nil(t, maybePeakAttachmentURL(m))
  13. require.Equal(t, "ntfy.png", m.Attachment.Name)
  14. require.Equal(t, int64(3627), m.Attachment.Size)
  15. require.Equal(t, "image/png", m.Attachment.Type)
  16. require.Equal(t, int64(0), m.Attachment.Expires)
  17. }