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

Function TestValidateMonitorCondition

api/model/model_test.go:500–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

498}
499
500func TestValidateMonitorCondition(t *testing.T) {
501 tests := []struct {
502 name string
503 condition MonitorCondition
504 wantErr bool
505 }{
506 {
507 name: "Valid condition - balance",
508 condition: MonitorCondition{
509 Field: "balance",
510 Operator: ">",
511 Value: 100,
512 Precision: 100,
513 },
514 wantErr: false,
515 },
516 {
517 name: "Valid condition - credit_balance",
518 condition: MonitorCondition{
519 Field: "credit_balance",
520 Operator: "<",
521 Value: 500,
522 Precision: 100,
523 },
524 wantErr: false,
525 },
526 {
527 name: "Valid condition - debit_balance",
528 condition: MonitorCondition{
529 Field: "debit_balance",
530 Operator: ">=",
531 Value: 1,
532 Precision: 100,
533 },
534 wantErr: false,
535 },
536 {
537 name: "Valid condition - inflight_balance",
538 condition: MonitorCondition{
539 Field: "inflight_balance",
540 Operator: "<=",
541 Value: 1000,
542 Precision: 100,
543 },
544 wantErr: false,
545 },
546 {
547 name: "Invalid field",
548 condition: MonitorCondition{
549 Field: "invalid_field",
550 Operator: ">",
551 Value: 100,
552 Precision: 100,
553 },
554 wantErr: true,
555 },
556 {
557 name: "Missing field",

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected