(t *testing.T)
| 1422 | } |
| 1423 | |
| 1424 | func 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 | |
| 1450 | func TestIsTransactionRefunded_Error(t *testing.T) { |
| 1451 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected