(t *testing.T)
| 120 | } |
| 121 | |
| 122 | func TestUpdateMatchingRule(t *testing.T) { |
| 123 | router, _, err := setupRouter(t) |
| 124 | if err != nil { |
| 125 | t.Fatalf("Failed to setup router: %v", err) |
| 126 | } |
| 127 | |
| 128 | t.Run("Missing rule ID", func(t *testing.T) { |
| 129 | payload := struct { |
| 130 | Name string `json:"name"` |
| 131 | Description string `json:"description"` |
| 132 | }{ |
| 133 | Name: "Updated Rule", |
| 134 | Description: "Updated description", |
| 135 | } |
| 136 | payloadBytes, _ := request.ToJsonReq(&payload) |
| 137 | req := httptest.NewRequest("PUT", "/reconciliation/matching-rules/", payloadBytes) |
| 138 | req.Header.Set("Content-Type", "application/json") |
| 139 | resp := httptest.NewRecorder() |
| 140 | router.ServeHTTP(resp, req) |
| 141 | assert.Equal(t, http.StatusNotFound, resp.Code) |
| 142 | }) |
| 143 | |
| 144 | t.Run("Invalid JSON", func(t *testing.T) { |
| 145 | req := httptest.NewRequest("PUT", "/reconciliation/matching-rules/mr_test", bytes.NewReader([]byte("invalid json"))) |
| 146 | req.Header.Set("Content-Type", "application/json") |
| 147 | resp := httptest.NewRecorder() |
| 148 | router.ServeHTTP(resp, req) |
| 149 | assert.Equal(t, http.StatusBadRequest, resp.Code) |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | func TestDeleteMatchingRule(t *testing.T) { |
| 154 | router, _, err := setupRouter(t) |
nothing calls this directly
no test coverage detected