(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestSendWebhook(t *testing.T) { |
| 43 | mr, err := miniredis.Run() |
| 44 | if err != nil { |
| 45 | t.Fatalf("an error '%s' occurred when starting miniredis", err) |
| 46 | } |
| 47 | defer mr.Close() |
| 48 | |
| 49 | cnf := &config.Configuration{ |
| 50 | Redis: config.RedisConfig{ |
| 51 | Dns: mr.Addr(), |
| 52 | }, |
| 53 | Queue: config.QueueConfig{ |
| 54 | WebhookQueue: "webhook_queue", |
| 55 | NumberOfQueues: 1, |
| 56 | }, |
| 57 | Notification: config.Notification{ |
| 58 | Webhook: config.WebhookConfig{ |
| 59 | Url: "http://localhost:8080", |
| 60 | }, |
| 61 | }, |
| 62 | } |
| 63 | config.ConfigStore.Store(cnf) |
| 64 | |
| 65 | testData := NewWebhook{ |
| 66 | Event: "transaction.queued", |
| 67 | Payload: getTransactionMock(10000, false), |
| 68 | } |
| 69 | ledgerforge, err := NewLedgerForge(nil) |
| 70 | assert.NoError(t, err) |
| 71 | |
| 72 | err = ledgerforge.SendWebhook(testData) |
| 73 | assert.NoError(t, err) |
| 74 | |
| 75 | // Verify that the task was enqueued |
| 76 | assert.NoError(t, err) |
| 77 | tasks := mr.Keys() |
| 78 | assert.NoError(t, err) |
| 79 | assert.NotEmpty(t, tasks) |
| 80 | } |
| 81 | |
| 82 | func TestConnectionReuse(t *testing.T) { |
| 83 | // Track unique connections |
nothing calls this directly
no test coverage detected