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

Function TestIsTransactionRefunded_False

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

Source from the content-addressed store, hash-verified

1422}
1423
1424func TestIsTransactionRefunded_False(t *testing.T) {
1425 db, mock, err := sqlmock.New()
1426 assert.NoError(t, err)
1427 defer func() { _ = db.Close() }()
1428
1429 ds := Datasource{Conn: db}
1430 ctx := context.Background()
1431
1432 txn := &model.Transaction{
1433 TransactionID: "txn_123",
1434 Source: "bln_source",
1435 Destination: "bln_dest",
1436 }
1437
1438 mock.ExpectQuery("SELECT EXISTS").
1439 WithArgs(txn.TransactionID, txn.Destination, txn.Source).
1440 WillReturnRows(sqlmock.NewRows([]string{"exists"}).AddRow(false))
1441
1442 isRefunded, err := ds.IsTransactionRefunded(ctx, txn)
1443 assert.NoError(t, err)
1444 assert.False(t, isRefunded)
1445
1446 err = mock.ExpectationsWereMet()
1447 assert.NoError(t, err)
1448}
1449
1450func TestIsTransactionRefunded_Error(t *testing.T) {
1451 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 2

IsTransactionRefundedMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected