(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestUpdateBalanceMetadata(t *testing.T) { |
| 58 | db, mock, err := sqlmock.New() |
| 59 | assert.NoError(t, err) |
| 60 | defer func() { _ = db.Close() }() |
| 61 | |
| 62 | ds := Datasource{Conn: db} |
| 63 | ctx := context.Background() |
| 64 | metadata := map[string]interface{}{ |
| 65 | "type": "savings", |
| 66 | "tier": "premium", |
| 67 | } |
| 68 | |
| 69 | metadataJSON, _ := json.Marshal(metadata) |
| 70 | mock.ExpectExec("UPDATE ledgerforge.balances"). |
| 71 | WithArgs(metadataJSON, "bal_123"). |
| 72 | WillReturnResult(sqlmock.NewResult(1, 1)) |
| 73 | |
| 74 | err = ds.UpdateBalanceMetadata(ctx, "bal_123", metadata) |
| 75 | assert.NoError(t, err) |
| 76 | assert.NoError(t, mock.ExpectationsWereMet()) |
| 77 | } |
| 78 | |
| 79 | func TestUpdateIdentityMetadata(t *testing.T) { |
| 80 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected