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

Function TestUpdateMatchingRule_Success

database/reconciliation_test.go:688–709  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

686}
687
688func TestUpdateMatchingRule_Success(t *testing.T) {
689 db, mock, err := sqlmock.New()
690 assert.NoError(t, err)
691 defer func() { _ = db.Close() }()
692
693 ds := Datasource{Conn: db}
694 ctx := context.TODO()
695
696 rule := &model.MatchingRule{
697 RuleID: "rule1",
698 Name: "Updated Rule",
699 Description: "Updated description",
700 Criteria: []model.MatchingCriteria{{Field: "amount", Operator: "equals", Value: "200"}},
701 }
702
703 mock.ExpectExec("UPDATE ledgerforge.matching_rules SET name").
704 WithArgs(rule.RuleID, rule.Name, rule.Description, sqlmock.AnyArg()).
705 WillReturnResult(sqlmock.NewResult(0, 1))
706
707 err = ds.UpdateMatchingRule(ctx, rule)
708 assert.NoError(t, err)
709}
710
711func TestUpdateMatchingRule_NotFound(t *testing.T) {
712 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 2

UpdateMatchingRuleMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected