(t *testing.T)
| 4273 | } |
| 4274 | |
| 4275 | func TestRefundWorkerFullFlow(t *testing.T) { |
| 4276 | // Skip in short mode |
| 4277 | if testing.Short() { |
| 4278 | t.Skip("Skipping refund worker test in short mode") |
| 4279 | } |
| 4280 | |
| 4281 | ctx := context.Background() |
| 4282 | cnf := &config.Configuration{ |
| 4283 | Redis: config.RedisConfig{ |
| 4284 | Dns: "localhost:6379", |
| 4285 | }, |
| 4286 | DataSource: config.DataSourceConfig{ |
| 4287 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 4288 | }, |
| 4289 | Queue: config.QueueConfig{ |
| 4290 | WebhookQueue: "webhook_queue_test", |
| 4291 | IndexQueue: "index_queue_test", |
| 4292 | TransactionQueue: "transaction_queue_test", |
| 4293 | NumberOfQueues: 1, |
| 4294 | }, |
| 4295 | Server: config.ServerConfig{ |
| 4296 | SecretKey: "test-secret", |
| 4297 | }, |
| 4298 | Transaction: config.TransactionConfig{ |
| 4299 | BatchSize: 100, |
| 4300 | MaxQueueSize: 1000, |
| 4301 | LockDuration: time.Second * 30, |
| 4302 | IndexQueuePrefix: "test_index", |
| 4303 | }, |
| 4304 | } |
| 4305 | config.ConfigStore.Store(cnf) |
| 4306 | |
| 4307 | ds, err := database.NewDataSource(cnf) |
| 4308 | require.NoError(t, err, "Failed to create datasource") |
| 4309 | |
| 4310 | ledgerforge, err := NewLedgerForge(ds) |
| 4311 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 4312 | |
| 4313 | // Create test balances with initial amounts of zero |
| 4314 | sourceBalance := &model.Balance{ |
| 4315 | Currency: "USD", |
| 4316 | LedgerID: "general_ledger_id", |
| 4317 | } |
| 4318 | destBalance := &model.Balance{ |
| 4319 | Currency: "USD", |
| 4320 | LedgerID: "general_ledger_id", |
| 4321 | } |
| 4322 | |
| 4323 | source, err := ds.CreateBalance(*sourceBalance) |
| 4324 | require.NoError(t, err, "Failed to create source balance") |
| 4325 | |
| 4326 | dest, err := ds.CreateBalance(*destBalance) |
| 4327 | require.NoError(t, err, "Failed to create destination balance") |
| 4328 | |
| 4329 | // Step 1: Create a standard (non-inflight) transaction with skip_queue set to true |
| 4330 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("refund_flow_test") |
| 4331 | txn := &model.Transaction{ |
| 4332 | Reference: txnRef, |
nothing calls this directly
no test coverage detected