MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestStartReconciliation

Function TestStartReconciliation

api/reconciliation_api_test.go:29–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func 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
60func TestInstantReconciliation(t *testing.T) {
61 router, _, err := setupRouter(t)

Callers

nothing calls this directly

Calls 3

ToJsonReqFunction · 0.92
setupRouterFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected