Debian Codegraph @

testing/e2e/discord/embed_fields_test.go

raw
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 Embed Fields Test", func() {
16 ginkgo.When("running e2e tests", func() {
17 ginkgo.It("should send rich embed with custom fields", func() {
18 envURL := os.Getenv("SHOUTRRR_DISCORD_URL")
19 if envURL == "" {
20 ginkgo.Skip("SHOUTRRR_DISCORD_URL not set, skipping custom fields 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: Embed with custom fields",
33 Fields: []types.Field{
34 {Key: "Status", Value: "Testing"},
35 {Key: "Environment", Value: "E2E"},
36 {Key: "Feature", Value: "Custom Fields"},
37 },
38 },
39 }
40 err = service.SendItems(items, nil)
41 gomega.Expect(err).NotTo(gomega.HaveOccurred())
42 })
43 })
44 })