(t *testing.T)
| 27 | ) |
| 28 | |
| 29 | func TestStartReconciliation(t *testing.T) { |
| 30 | router, _, err := setupRouter(t) |
| 31 | if err != nil { |
| 32 | t.Fatalf("Failed to setup router: %v", err) |
| 33 | } |
| 34 | |
| 35 | t.Run("Missing required fields", func(t *testing.T) { |
| 36 | payload := struct { |
| 37 | UploadID string `json:"upload_id"` |
| 38 | Strategy string `json:"strategy"` |
| 39 | }{ |
| 40 | UploadID: "", |
| 41 | Strategy: "", |
| 42 | } |
| 43 | payloadBytes, _ := request.ToJsonReq(&payload) |
| 44 | req := httptest.NewRequest("POST", "/reconciliation/start", payloadBytes) |
| 45 | req.Header.Set("Content-Type", "application/json") |
| 46 | resp := httptest.NewRecorder() |
| 47 | router.ServeHTTP(resp, req) |
| 48 | assert.Equal(t, http.StatusBadRequest, resp.Code) |
| 49 | }) |
| 50 | |
| 51 | t.Run("Invalid JSON", func(t *testing.T) { |
| 52 | req := httptest.NewRequest("POST", "/reconciliation/start", bytes.NewReader([]byte("invalid json"))) |
| 53 | req.Header.Set("Content-Type", "application/json") |
| 54 | resp := httptest.NewRecorder() |
| 55 | router.ServeHTTP(resp, req) |
| 56 | assert.Equal(t, http.StatusBadRequest, resp.Code) |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | func TestInstantReconciliation(t *testing.T) { |
| 61 | router, _, err := setupRouter(t) |
nothing calls this directly
no test coverage detected