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

Function TestIsTransactionRefunded_True

database/transactions_test.go:1398–1422  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1396}
1397
1398func TestIsTransactionRefunded_True(t *testing.T) {
1399 db, mock, err := sqlmock.New()
1400 assert.NoError(t, err)
1401 defer func() { _ = db.Close() }()
1402
1403 ds := Datasource{Conn: db}
1404 ctx := context.Background()
1405
1406 txn := &model.Transaction{
1407 TransactionID: "txn_123",
1408 Source: "bln_source",
1409 Destination: "bln_dest",
1410 }
1411
1412 mock.ExpectQuery("SELECT EXISTS").
1413 WithArgs(txn.TransactionID, txn.Destination, txn.Source).
1414 WillReturnRows(sqlmock.NewRows([]string{"exists"}).AddRow(true))
1415
1416 isRefunded, err := ds.IsTransactionRefunded(ctx, txn)
1417 assert.NoError(t, err)
1418 assert.True(t, isRefunded)
1419
1420 err = mock.ExpectationsWereMet()
1421 assert.NoError(t, err)
1422}
1423
1424func TestIsTransactionRefunded_False(t *testing.T) {
1425 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 2

IsTransactionRefundedMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected