(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func TestInstantReconciliation(t *testing.T) { |
| 61 | router, _, err := setupRouter(t) |
| 62 | if err != nil { |
| 63 | t.Fatalf("Failed to setup router: %v", err) |
| 64 | } |
| 65 | |
| 66 | t.Run("Missing external transactions", func(t *testing.T) { |
| 67 | payload := struct { |
| 68 | ExternalTransactions []interface{} `json:"external_transactions"` |
| 69 | Strategy string `json:"strategy"` |
| 70 | MatchingRuleIDs []string `json:"matching_rule_ids"` |
| 71 | }{ |
| 72 | ExternalTransactions: []interface{}{}, |
| 73 | Strategy: "one_to_one", |
| 74 | MatchingRuleIDs: []string{"mr_test"}, |
| 75 | } |
| 76 | payloadBytes, _ := request.ToJsonReq(&payload) |
| 77 | req := httptest.NewRequest("POST", "/reconciliation/start-instant", payloadBytes) |
| 78 | req.Header.Set("Content-Type", "application/json") |
| 79 | resp := httptest.NewRecorder() |
| 80 | router.ServeHTTP(resp, req) |
| 81 | assert.Equal(t, http.StatusBadRequest, resp.Code) |
| 82 | }) |
| 83 | |
| 84 | t.Run("Invalid JSON", func(t *testing.T) { |
| 85 | req := httptest.NewRequest("POST", "/reconciliation/start-instant", bytes.NewReader([]byte("invalid json"))) |
| 86 | req.Header.Set("Content-Type", "application/json") |
| 87 | resp := httptest.NewRecorder() |
| 88 | router.ServeHTTP(resp, req) |
| 89 | assert.Equal(t, http.StatusBadRequest, resp.Code) |
| 90 | }) |
| 91 | } |
| 92 | |
| 93 | func TestGetReconciliation(t *testing.T) { |
| 94 | router, _, err := setupRouter(t) |
nothing calls this directly
no test coverage detected