Properly handle different attachment use cases
This commit is contained in:
parent
cefe276ce5
commit
44a9509cd6
7 changed files with 202 additions and 75 deletions
19
server/util_test.go
Normal file
19
server/util_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMaybePeakAttachmentURL_Success(t *testing.T) {
|
||||
m := &message{
|
||||
Attachment: &attachment{
|
||||
URL: "https://ntfy.sh/static/img/ntfy.png",
|
||||
},
|
||||
}
|
||||
require.Nil(t, maybePeakAttachmentURL(m))
|
||||
require.Equal(t, "ntfy.png", m.Attachment.Name)
|
||||
require.Equal(t, int64(3627), m.Attachment.Size)
|
||||
require.Equal(t, "image/png", m.Attachment.Type)
|
||||
require.Equal(t, int64(0), m.Attachment.Expires)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue