(t *testing.T)
| 77 | } |
| 78 | |
| 79 | func TestUpdateIdentityMetadata(t *testing.T) { |
| 80 | db, mock, err := sqlmock.New() |
| 81 | assert.NoError(t, err) |
| 82 | defer func() { _ = db.Close() }() |
| 83 | |
| 84 | ds := Datasource{Conn: db} |
| 85 | metadata := map[string]interface{}{ |
| 86 | "verified": true, |
| 87 | "level": 2, |
| 88 | } |
| 89 | |
| 90 | metadataJSON, _ := json.Marshal(metadata) |
| 91 | mock.ExpectExec("UPDATE ledgerforge.identity"). |
| 92 | WithArgs(metadataJSON, "idt_123"). |
| 93 | WillReturnResult(sqlmock.NewResult(1, 1)) |
| 94 | |
| 95 | err = ds.UpdateIdentityMetadata("idt_123", metadata) |
| 96 | assert.NoError(t, err) |
| 97 | assert.NoError(t, mock.ExpectationsWereMet()) |
| 98 | } |
| 99 | |
| 100 | func TestUpdateMetadata_Error(t *testing.T) { |
| 101 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected