(t *testing.T)
| 599 | } |
| 600 | |
| 601 | func TestGetMatchingRules_Error(t *testing.T) { |
| 602 | db, mock, err := sqlmock.New() |
| 603 | assert.NoError(t, err) |
| 604 | defer func() { _ = db.Close() }() |
| 605 | |
| 606 | ds := Datasource{Conn: db} |
| 607 | ctx := context.TODO() |
| 608 | |
| 609 | mock.ExpectQuery("SELECT id, rule_id, created_at, updated_at, name, description, criteria FROM ledgerforge.matching_rules"). |
| 610 | WillReturnError(fmt.Errorf("query error")) |
| 611 | |
| 612 | rules, err := ds.GetMatchingRules(ctx) |
| 613 | assert.Error(t, err) |
| 614 | assert.Nil(t, rules) |
| 615 | assert.Equal(t, apierror.ErrInternalServer, err.(apierror.APIError).Code) |
| 616 | } |
| 617 | |
| 618 | func TestGetMatchingRule_Success(t *testing.T) { |
| 619 | db, mock, err := sqlmock.New() |
nothing calls this directly
no test coverage detected