(t *testing.T)
| 709 | } |
| 710 | |
| 711 | func 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 | |
| 735 | func TestGetExternalTransactionsByReconciliationID_Success(t *testing.T) { |
| 736 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected