(t *testing.T, webhookPath string, expectedCount int, timeout time.Duration)
| 285 | } |
| 286 | |
| 287 | func waitForWebhookEvents(t *testing.T, webhookPath string, expectedCount int, timeout time.Duration) []wmJournal.GetRequestResponse { |
| 288 | t.Helper() |
| 289 | deadline := time.Now().Add(timeout) |
| 290 | |
| 291 | for time.Now().Before(deadline) { |
| 292 | requests := findWebhookRequests(t, webhookPath) |
| 293 | if len(requests) >= expectedCount { |
| 294 | return requests |
| 295 | } |
| 296 | time.Sleep(500 * time.Millisecond) |
| 297 | } |
| 298 | |
| 299 | requests := findWebhookRequests(t, webhookPath) |
| 300 | require.GreaterOrEqual(t, len(requests), expectedCount, "expected at least %d webhook events on %s, got %d", expectedCount, webhookPath, len(requests)) |
| 301 | return requests |
| 302 | } |
| 303 | |
| 304 | func waitForFCMPush(t *testing.T, messageID string, timeout time.Duration) []wmJournal.GetRequestResponse { |
| 305 | t.Helper() |
no test coverage detected