| 1 | package discord_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "net/httpscip-go gomod github.com/golang/go/src . `net/http`/" |
| 5 | "stringsscip-go gomod github.com/golang/go/src . strings/" |
| 6 | "testingscip-go gomod github.com/golang/go/src . testing/" |
| 7 | "testing/synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/" |
| 8 | "unicode/utf8scip-go gomod github.com/golang/go/src . `unicode/utf8`/" |
| 9 | |
| 10 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/assert`/" |
| 11 | "github.com/stretchr/testify/mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/" |
| 12 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 13 | |
| 14 | "github.com/nicholas-fedor/shoutrrr/pkg/typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/" |
| 15 | ) |
| 16 | |
| 17 | func TestEmptyMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestEmptyMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 18 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 19 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 20 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 21 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 22 | t, |
| 23 | "discord://test-token@test-webhook", |
| 24 | mockClient, |
| 25 | ) |
| 26 | |
| 27 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("", nil) |
| 28 | |
| 29 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 30 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "message is empty") |
| 31 | |
| 32 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 33 | }) |
| 34 | } |
| 35 | |
| 36 | func TestNilMessageItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestNilMessageItems().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 37 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 38 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 39 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 40 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 41 | t, |
| 42 | "discord://test-token@test-webhook", |
| 43 | mockClient, |
| 44 | ) |
| 45 | |
| 46 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(nil, nil) |
| 47 | |
| 48 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 49 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "creating payload") |
| 50 | |
| 51 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 52 | }) |
| 53 | } |
| 54 | |
| 55 | func TestEmptyMessageItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestEmptyMessageItems().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 56 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 57 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 58 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 59 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 60 | t, |
| 61 | "discord://test-token@test-webhook", |
| 62 | mockClient, |
| 63 | ) |
| 64 | |
| 65 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().([]typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{}, nil) |
| 66 | |
| 67 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 68 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "creating payload") |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | func TestUnicodeMessagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestUnicodeMessages().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 73 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 74 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 75 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 76 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 77 | t, |
| 78 | "discord://test-token@test-webhook", |
| 79 | mockClient, |
| 80 | ) |
| 81 | |
| 82 | tests := []struct { |
| 83 | name string |
| 84 | message string |
| 85 | }{ |
| 86 | {"emoji", "Hello 🌍 🚀 ❤️"}, |
| 87 | {"chinese", "你好世界"}, |
| 88 | {"japanese", "こんにちは世界"}, |
| 89 | {"arabic", "مرحبا بالعالم"}, |
| 90 | {"mixed", "Hello 世界 🌍 こんにちは 🚀"}, |
| 91 | {"combining", "café naïve résumé"}, |
| 92 | {"zero width", "test\u200bhidden\u200btext"}, // zero-width spaces |
| 93 | } |
| 94 | |
| 95 | for _, tt := range tests { |
| 96 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 97 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 98 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 99 | |
| 100 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(tt.message, nil) |
| 101 | |
| 102 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 103 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, utf8scip-go gomod github.com/golang/go/src . `unicode/utf8`/.ValidStringscip-go gomod github.com/golang/go/src . `unicode/utf8`/ValidString().(tt.message), "Message should be valid UTF-8") |
| 104 | } |
| 105 | |
| 106 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 107 | }) |
| 108 | } |
| 109 | |
| 110 | func TestControlCharactersscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestControlCharacters().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 111 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 112 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 113 | tests := []struct { |
| 114 | name string |
| 115 | message string |
| 116 | }{ |
| 117 | {"newlines", "Line 1\nLine 2\nLine 3"}, |
| 118 | {"tabs", "Col1\tCol2\tCol3"}, |
| 119 | {"carriage return", "Line 1\r\nLine 2"}, |
| 120 | {"form feed", "Page 1\fPage 2"}, |
| 121 | {"vertical tab", "Line 1\vLine 2"}, |
| 122 | {"backspace", "Text\b"}, |
| 123 | {"null byte", "Text\x00More"}, |
| 124 | {"escape", "Text\x1b[31mRed\x1b[0m"}, |
| 125 | } |
| 126 | |
| 127 | for _, tt := range tests { |
| 128 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 129 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 130 | t, |
| 131 | "discord://test-token@test-webhook", |
| 132 | mockClient, |
| 133 | ) |
| 134 | |
| 135 | // With splitLines enabled by default, all lines are sent as embeds in one request |
| 136 | expectedCalls := 1 |
| 137 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 138 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 139 | Timesscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Times().(expectedCalls) |
| 140 | |
| 141 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(tt.message, nil) |
| 142 | |
| 143 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 144 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 145 | } |
| 146 | }) |
| 147 | } |
| 148 | |
| 149 | func TestVeryLongMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestVeryLongMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 150 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 151 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 152 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 153 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 154 | t, |
| 155 | "discord://test-token@test-webhook", |
| 156 | mockClient, |
| 157 | ) |
| 158 | |
| 159 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 160 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 161 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 162 | // Long message sent as one |
| 163 | |
| 164 | longMessage := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("This is a very long message that should be chunked. ", 1000) |
| 165 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(longMessage, nil) |
| 166 | |
| 167 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 168 | mockClient.AssertNumberOfCallsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertNumberOfCalls().(t, "Do", 1) |
| 169 | |
| 170 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 171 | }) |
| 172 | } |
| 173 | |
| 174 | func TestMessageWithMaximumLengthscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestMessageWithMaximumLength().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 175 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 176 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 177 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 178 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 179 | t, |
| 180 | "discord://test-token@test-webhook", |
| 181 | mockClient, |
| 182 | ) |
| 183 | |
| 184 | // Discord's max message length is 2000 chars |
| 185 | maxLengthMessage := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("a", 2000) |
| 186 | |
| 187 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 188 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 189 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 190 | |
| 191 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(maxLengthMessage, nil) |
| 192 | |
| 193 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 194 | |
| 195 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 196 | }) |
| 197 | } |
| 198 | |
| 199 | func TestMessageWithNullBytesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestMessageWithNullBytes().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 200 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 201 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 202 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 203 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 204 | t, |
| 205 | "discord://test-token@test-webhook", |
| 206 | mockClient, |
| 207 | ) |
| 208 | |
| 209 | messageWithNulls := "Hello\x00World\x00Test" |
| 210 | |
| 211 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 212 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 213 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 214 | |
| 215 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(messageWithNulls, nil) |
| 216 | |
| 217 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 218 | |
| 219 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 220 | }) |
| 221 | } |
| 222 | |
| 223 | func TestInvalidUTF8scip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestInvalidUTF8().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 224 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 225 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 226 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 227 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 228 | t, |
| 229 | "discord://test-token@test-webhook", |
| 230 | mockClient, |
| 231 | ) |
| 232 | |
| 233 | // Create invalid UTF-8 sequence |
| 234 | invalidUTF8 := []byte{0x80, 0x81, 0x82} // Invalid UTF-8 start bytes |
| 235 | message := string(invalidUTF8) |
| 236 | |
| 237 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, utf8scip-go gomod github.com/golang/go/src . `unicode/utf8`/.ValidStringscip-go gomod github.com/golang/go/src . `unicode/utf8`/ValidString().(message), "Should be invalid UTF-8") |
| 238 | |
| 239 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 240 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 241 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 242 | |
| 243 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(message, nil) |
| 244 | |
| 245 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) // Should handle invalid UTF-8 gracefully |
| 246 | |
| 247 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 248 | }) |
| 249 | } |
| 250 | |
| 251 | func TestExtremelyLargeFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestExtremelyLargeFile().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 252 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 253 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 254 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 255 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 256 | t, |
| 257 | "discord://test-token@test-webhook", |
| 258 | mockClient, |
| 259 | ) |
| 260 | |
| 261 | // Test with a very large file (simulated) |
| 262 | largeData := make([]byte, 50*1024*1024) // 50MB |
| 263 | for i := range largeData { |
| 264 | largeData[i] = byte(i % 256) |
| 265 | } |
| 266 | |
| 267 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 268 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 269 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 270 | |
| 271 | items := []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 272 | createTestMessageItemWithFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItemWithFile().("Large file", "large.dat", largeData), |
| 273 | } |
| 274 | |
| 275 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 276 | |
| 277 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 278 | |
| 279 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 280 | }) |
| 281 | } |
| 282 | |
| 283 | func TestFileWithEmptyNamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestFileWithEmptyName().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 284 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 285 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 286 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 287 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 288 | t, |
| 289 | "discord://test-token@test-webhook", |
| 290 | mockClient, |
| 291 | ) |
| 292 | |
| 293 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 294 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 295 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 296 | |
| 297 | items := []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 298 | createTestMessageItemWithFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItemWithFile().("Test", "", []byte("content")), |
| 299 | } |
| 300 | |
| 301 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 302 | |
| 303 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 304 | |
| 305 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 306 | }) |
| 307 | } |
| 308 | |
| 309 | func TestFileWithSpecialCharactersInNamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestFileWithSpecialCharactersInName().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 310 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 311 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 312 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 313 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 314 | t, |
| 315 | "discord://test-token@test-webhook", |
| 316 | mockClient, |
| 317 | ) |
| 318 | |
| 319 | specialNames := []string{ |
| 320 | "file with spaces.txt", |
| 321 | "file-with-dashes.txt", |
| 322 | "file_with_underscores.txt", |
| 323 | "file.with.dots.txt", |
| 324 | "file(1).txt", |
| 325 | "file[1].txt", |
| 326 | "file+plus.txt", |
| 327 | "file%percent.txt", |
| 328 | "file#hash.txt", |
| 329 | "[email protected]", |
| 330 | "file$dollar.txt", |
| 331 | "file&ersand.txt", |
| 332 | "file*star.txt", |
| 333 | "file?question.txt", |
| 334 | "file^caret.txt", |
| 335 | "file`backtick.txt", |
| 336 | "file|pipe.txt", |
| 337 | "file\\backslash.txt", |
| 338 | "file/slash.txt", |
| 339 | "file:colon.txt", |
| 340 | "file;semicolon.txt", |
| 341 | "file<less.txt", |
| 342 | "file>greater.txt", |
| 343 | "file\"quote.txt", |
| 344 | "file'apostrophe.txt", |
| 345 | } |
| 346 | |
| 347 | for _, filename := range specialNames { |
| 348 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 349 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 350 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 351 | |
| 352 | items := []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 353 | createTestMessageItemWithFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItemWithFile().("Test file", filename, []byte("content")), |
| 354 | } |
| 355 | |
| 356 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 357 | |
| 358 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 359 | } |
| 360 | |
| 361 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 362 | }) |
| 363 | } |
| 364 | |
| 365 | func TestConcurrentRequestsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestConcurrentRequests().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 366 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 367 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 368 | // Test multiple concurrent requests |
| 369 | done := make(chan bool, 3) |
| 370 | |
| 371 | for i := range 3 { |
| 372 | go func(_ int) { |
| 373 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 374 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 375 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 376 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 377 | |
| 378 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().(t, "discord://test-token@test-webhook", mockClient) |
| 379 | |
| 380 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Concurrent message", nil) |
| 381 | assertscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 382 | |
| 383 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 384 | |
| 385 | done <- true |
| 386 | }(i) |
| 387 | } |
| 388 | |
| 389 | // Wait for all goroutines to complete |
| 390 | for range 3 { |
| 391 | <-done |
| 392 | } |
| 393 | }) |
| 394 | } |
| 395 | |
| 396 | func TestMemoryExhaustionSimulationscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestMemoryExhaustionSimulation().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 397 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 398 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 399 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 400 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 401 | t, |
| 402 | "discord://test-token@test-webhook", |
| 403 | mockClient, |
| 404 | ) |
| 405 | |
| 406 | // Test with many large embeds |
| 407 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 408 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 409 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 410 | |
| 411 | items := make([]typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#, 0, 10) |
| 412 | for i := range 10 { |
| 413 | items = append(items, typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 414 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Text.: "Embed " + string(rune(i+'0')), |
| 415 | Fieldsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Fields.: []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Fieldscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#{ |
| 416 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "Field1", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("Value", 100)}, |
| 417 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "Field2", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("Value", 100)}, |
| 418 | }, |
| 419 | }) |
| 420 | } |
| 421 | |
| 422 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 423 | |
| 424 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 425 | |
| 426 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 427 | }) |
| 428 | } |
| 429 | |
| 430 | func TestRapidSuccessionRequestsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestRapidSuccessionRequests().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 431 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 432 | synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 433 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 434 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 435 | t, |
| 436 | "discord://test-token@test-webhook", |
| 437 | mockClient, |
| 438 | ) |
| 439 | |
| 440 | // Test many requests in quick succession |
| 441 | for range 10 { |
| 442 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.). |
| 443 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 444 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 445 | } |
| 446 | |
| 447 | for range 10 { |
| 448 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Message", nil) |
| 449 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 450 | } |
| 451 | |
| 452 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 453 | }) |
| 454 | } |