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

Function TestGetMatchingRule_NotFound

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

Source from the content-addressed store, hash-verified

635}
636
637func 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
655func TestDeleteMatchingRule_Success(t *testing.T) {
656 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 3

GetMatchingRuleMethod · 0.95
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected