(t *testing.T)
| 635 | } |
| 636 | |
| 637 | func TestGetMatchingRule_NotFound(t *testing.T) { |
| 638 | db, mock, err := sqlmock.New() |
| 639 | assert.NoError(t, err) |
| 640 | defer func() { _ = db.Close() }() |
| 641 | |
| 642 | ds := Datasource{Conn: db} |
| 643 | ctx := context.TODO() |
| 644 | |
| 645 | mock.ExpectQuery("SELECT id, rule_id, created_at, updated_at, name, description, criteria FROM ledgerforge.matching_rules WHERE rule_id"). |
| 646 | WithArgs("rule_notfound"). |
| 647 | WillReturnError(sql.ErrNoRows) |
| 648 | |
| 649 | rule, err := ds.GetMatchingRule(ctx, "rule_notfound") |
| 650 | assert.Error(t, err) |
| 651 | assert.Nil(t, rule) |
| 652 | assert.Equal(t, apierror.ErrNotFound, err.(apierror.APIError).Code) |
| 653 | } |
| 654 | |
| 655 | func TestDeleteMatchingRule_Success(t *testing.T) { |
| 656 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected