(t *testing.T)
| 1662 | } |
| 1663 | |
| 1664 | func TestUpdateBalanceIdentity_Success(t *testing.T) { |
| 1665 | db, mock, err := sqlmock.New() |
| 1666 | assert.NoError(t, err) |
| 1667 | defer func() { _ = db.Close() }() |
| 1668 | |
| 1669 | ds := Datasource{Conn: db} |
| 1670 | |
| 1671 | query := ` |
| 1672 | UPDATE ledgerforge.balances |
| 1673 | SET identity_id = $2 |
| 1674 | WHERE balance_id = $1 |
| 1675 | ` |
| 1676 | |
| 1677 | mock.ExpectExec(regexp.QuoteMeta(query)). |
| 1678 | WithArgs("bln_test_123", "idt_user_456"). |
| 1679 | WillReturnResult(sqlmock.NewResult(0, 1)) |
| 1680 | |
| 1681 | err = ds.UpdateBalanceIdentity("bln_test_123", "idt_user_456") |
| 1682 | assert.NoError(t, err) |
| 1683 | |
| 1684 | err = mock.ExpectationsWereMet() |
| 1685 | assert.NoError(t, err) |
| 1686 | } |
| 1687 | |
| 1688 | func TestUpdateBalanceIdentity_NotFound(t *testing.T) { |
| 1689 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected