MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestUpdateMonitor

Function TestUpdateMonitor

balance_test.go:441–462  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

439}
440
441func 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
464func TestDeleteMonitor(t *testing.T) {
465 datasource, mock, err := newTestDataSource()

Callers

nothing calls this directly

Calls 3

UpdateMonitorMethod · 0.95
newTestDataSourceFunction · 0.85
NewLedgerForgeFunction · 0.85

Tested by

no test coverage detected