(t *testing.T)
| 439 | } |
| 440 | |
| 441 | func TestUpdateMonitor(t *testing.T) { |
| 442 | datasource, mock, err := newTestDataSource() |
| 443 | if err != nil { |
| 444 | t.Fatalf("Error creating test data source: %s", err) |
| 445 | } |
| 446 | |
| 447 | d, err := NewLedgerForge(datasource) |
| 448 | if err != nil { |
| 449 | t.Fatalf("Error creating LedgerForge instance: %s", err) |
| 450 | } |
| 451 | monitor := &model.BalanceMonitor{MonitorID: "test-monitor", BalanceID: "test-balance", Description: "Updated Monitor"} |
| 452 | |
| 453 | mock.ExpectExec("UPDATE ledgerforge.balance_monitors").WithArgs(monitor.MonitorID, monitor.BalanceID, monitor.Condition.Field, monitor.Condition.Operator, monitor.Condition.Value, monitor.Description, monitor.CallBackURL).WillReturnResult(sqlmock.NewResult(1, 1)) |
| 454 | |
| 455 | err = d.UpdateMonitor(context.Background(), monitor) |
| 456 | |
| 457 | assert.NoError(t, err) |
| 458 | |
| 459 | if err := mock.ExpectationsWereMet(); err != nil { |
| 460 | t.Errorf("there were unfulfilled expectations: %s", err) |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | func TestDeleteMonitor(t *testing.T) { |
| 465 | datasource, mock, err := newTestDataSource() |
nothing calls this directly
no test coverage detected