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

Function TestRecordReconciliation_Success

database/reconciliation_test.go:59–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestRecordReconciliation_Success(t *testing.T) {
60 db, mock, err := sqlmock.New()
61 assert.NoError(t, err)
62 defer func() { _ = db.Close() }()
63
64 ds := Datasource{Conn: db}
65 ctx := context.TODO()
66 completedAt := time.Now()
67
68 rec := &model.Reconciliation{
69 ReconciliationID: "rec123",
70 UploadID: "upl123",
71 Status: "completed",
72 MatchedTransactions: 10,
73 UnmatchedTransactions: 5,
74 StartedAt: time.Now(),
75 CompletedAt: &completedAt,
76 }
77
78 mock.ExpectExec("INSERT INTO ledgerforge.reconciliations").
79 WithArgs(rec.ReconciliationID, rec.UploadID, rec.Status, rec.MatchedTransactions,
80 rec.UnmatchedTransactions, rec.StartedAt, rec.CompletedAt).
81 WillReturnResult(sqlmock.NewResult(1, 1))
82
83 err = ds.RecordReconciliation(ctx, rec)
84 assert.NoError(t, err)
85}
86
87func TestRecordReconciliation_Fail(t *testing.T) {
88 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 2

RecordReconciliationMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected