| 1 |
package e2e_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"net/url" |
| 5 |
"os" |
| 6 |
|
| 7 |
"github.com/onsi/ginkgo/v2" |
| 8 |
"github.com/onsi/gomega" |
| 9 |
|
| 10 |
"github.com/nicholas-fedor/shoutrrr/internal/testutils" |
| 11 |
"github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord" |
| 12 |
"github.com/nicholas-fedor/shoutrrr/pkg/types" |
| 13 |
) |
| 14 |
|
| 15 |
var _ = ginkgo.Describe("Discord E2E Multiple Files Test", func() { |
| 16 |
ginkgo.When("running e2e tests", func() { |
| 17 |
ginkgo.It("should send multiple file attachments", func() { |
| 18 |
envURL := os.Getenv("SHOUTRRR_DISCORD_URL") |
| 19 |
if envURL == "" { |
| 20 |
ginkgo.Skip("SHOUTRRR_DISCORD_URL not set, skipping multiple files test") |
| 21 |
|
| 22 |
return |
| 23 |
} |
| 24 |
|
| 25 |
serviceURL, _ := url.Parse(envURL) |
| 26 |
service := &discord.Service{} |
| 27 |
err := service.Initialize(serviceURL, testutils.TestLogger()) |
| 28 |
gomega.Expect(err).NotTo(gomega.HaveOccurred()) |
| 29 |
|
| 30 |
file1Data := []byte("Content of first test file") |
| 31 |
file2Data := []byte("Content of second test file") |
| 32 |
items := []types.MessageItem{ |
| 33 |
{ |
| 34 |
Text: "E2E Test: Multiple file attachments - File 1", |
| 35 |
File: &types.File{Name: "test1.txt", Data: file1Data}, |
| 36 |
}, |
| 37 |
{ |
| 38 |
Text: "E2E Test: Multiple file attachments - File 2", |
| 39 |
File: &types.File{Name: "test2.txt", Data: file2Data}, |
| 40 |
}, |
| 41 |
} |
| 42 |
err = service.SendItems(items, nil) |
| 43 |
gomega.Expect(err).NotTo(gomega.HaveOccurred()) |
| 44 |
}) |
| 45 |
}) |
| 46 |
}) |