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

Function TestRecordMatch_Success

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

Source from the content-addressed store, hash-verified

383}
384
385func TestRecordMatch_Success(t *testing.T) {
386 db, mock, err := sqlmock.New()
387 assert.NoError(t, err)
388 defer func() { _ = db.Close() }()
389
390 ds := Datasource{Conn: db}
391 ctx := context.TODO()
392
393 match := &model.Match{
394 ExternalTransactionID: "ext1",
395 InternalTransactionID: "int1",
396 ReconciliationID: "rec123",
397 Amount: 1000,
398 Date: time.Now(),
399 }
400
401 mock.ExpectExec("INSERT INTO ledgerforge.matches").
402 WithArgs(match.ExternalTransactionID, match.InternalTransactionID, match.ReconciliationID, match.Amount, match.Date).
403 WillReturnResult(sqlmock.NewResult(1, 1))
404
405 err = ds.RecordMatch(ctx, match)
406 assert.NoError(t, err)
407}
408
409func TestRecordMatch_Error(t *testing.T) {
410 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 2

RecordMatchMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected