(t *testing.T)
| 3809 | } |
| 3810 | |
| 3811 | func TestRejectTransaction(t *testing.T) { |
| 3812 | // Skip in short mode |
| 3813 | if testing.Short() { |
| 3814 | t.Skip("Skipping transaction rejection test in short mode") |
| 3815 | } |
| 3816 | |
| 3817 | ctx := context.Background() |
| 3818 | cnf := &config.Configuration{ |
| 3819 | Redis: config.RedisConfig{ |
| 3820 | Dns: "localhost:6379", |
| 3821 | }, |
| 3822 | DataSource: config.DataSourceConfig{ |
| 3823 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 3824 | }, |
| 3825 | Queue: config.QueueConfig{ |
| 3826 | WebhookQueue: "webhook_queue_test", |
| 3827 | IndexQueue: "index_queue_test", |
| 3828 | TransactionQueue: "transaction_queue_test", |
| 3829 | NumberOfQueues: 1, |
| 3830 | }, |
| 3831 | Server: config.ServerConfig{ |
| 3832 | SecretKey: "test-secret", |
| 3833 | }, |
| 3834 | Transaction: config.TransactionConfig{ |
| 3835 | BatchSize: 100, |
| 3836 | MaxQueueSize: 1000, |
| 3837 | LockDuration: time.Second * 30, |
| 3838 | IndexQueuePrefix: "test_index", |
| 3839 | }, |
| 3840 | } |
| 3841 | config.ConfigStore.Store(cnf) |
| 3842 | |
| 3843 | ds, err := database.NewDataSource(cnf) |
| 3844 | require.NoError(t, err, "Failed to create datasource") |
| 3845 | |
| 3846 | ledgerforge, err := NewLedgerForge(ds) |
| 3847 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 3848 | |
| 3849 | // Create a unique transaction reference |
| 3850 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("reject_test") |
| 3851 | |
| 3852 | // Create test balances |
| 3853 | sourceBalance := &model.Balance{ |
| 3854 | Currency: "USD", |
| 3855 | LedgerID: "general_ledger_id", |
| 3856 | } |
| 3857 | destBalance := &model.Balance{ |
| 3858 | Currency: "USD", |
| 3859 | LedgerID: "general_ledger_id", |
| 3860 | } |
| 3861 | |
| 3862 | source, err := ds.CreateBalance(*sourceBalance) |
| 3863 | require.NoError(t, err, "Failed to create source balance") |
| 3864 | |
| 3865 | dest, err := ds.CreateBalance(*destBalance) |
| 3866 | require.NoError(t, err, "Failed to create destination balance") |
| 3867 | |
| 3868 | // Create transaction to reject |
nothing calls this directly
no test coverage detected