| 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 Embeds Test", func() { |
| 16 |
ginkgo.When("running e2e tests", func() { |
| 17 |
ginkgo.It("should send multiple embeds", func() { |
| 18 |
envURL := os.Getenv("SHOUTRRR_DISCORD_URL") |
| 19 |
if envURL == "" { |
| 20 |
ginkgo.Skip("SHOUTRRR_DISCORD_URL not set, skipping multiple embeds 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 |
items := []types.MessageItem{ |
| 31 |
{ |
| 32 |
Text: "E2E Test: First embed in multiple embeds", |
| 33 |
Level: types.Info, |
| 34 |
Fields: []types.Field{ |
| 35 |
{Key: "embed_author_name", Value: "First Embed"}, |
| 36 |
}, |
| 37 |
}, |
| 38 |
{ |
| 39 |
Text: "E2E Test: Second embed in multiple embeds", |
| 40 |
Level: types.Warning, |
| 41 |
Fields: []types.Field{ |
| 42 |
{Key: "embed_author_name", Value: "Second Embed"}, |
| 43 |
}, |
| 44 |
}, |
| 45 |
} |
| 46 |
err = service.SendItems(items, nil) |
| 47 |
gomega.Expect(err).NotTo(gomega.HaveOccurred()) |
| 48 |
}) |
| 49 |
}) |
| 50 |
}) |