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

Function TestUpdateMatchingRule_NotFound

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

Source from the content-addressed store, hash-verified

709}
710
711func TestUpdateMatchingRule_NotFound(t *testing.T) {
712 db, mock, err := sqlmock.New()
713 assert.NoError(t, err)
714 defer func() { _ = db.Close() }()
715
716 ds := Datasource{Conn: db}
717 ctx := context.TODO()
718
719 rule := &model.MatchingRule{
720 RuleID: "rule_notfound",
721 Name: "Updated Rule",
722 Description: "Updated description",
723 Criteria: []model.MatchingCriteria{},
724 }
725
726 mock.ExpectExec("UPDATE ledgerforge.matching_rules SET name").
727 WithArgs(rule.RuleID, rule.Name, rule.Description, sqlmock.AnyArg()).
728 WillReturnResult(sqlmock.NewResult(0, 0))
729
730 err = ds.UpdateMatchingRule(ctx, rule)
731 assert.Error(t, err)
732 assert.Equal(t, apierror.ErrNotFound, err.(apierror.APIError).Code)
733}
734
735func TestGetExternalTransactionsByReconciliationID_Success(t *testing.T) {
736 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 3

UpdateMatchingRuleMethod · 0.95
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected