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

Function TestDeleteMatchingRule_NotFound

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

Source from the content-addressed store, hash-verified

669}
670
671func TestDeleteMatchingRule_NotFound(t *testing.T) {
672 db, mock, err := sqlmock.New()
673 assert.NoError(t, err)
674 defer func() { _ = db.Close() }()
675
676 ds := Datasource{Conn: db}
677 ctx := context.TODO()
678
679 mock.ExpectExec("DELETE FROM ledgerforge.matching_rules WHERE rule_id").
680 WithArgs("rule_notfound").
681 WillReturnResult(sqlmock.NewResult(0, 0))
682
683 err = ds.DeleteMatchingRule(ctx, "rule_notfound")
684 assert.Error(t, err)
685 assert.Equal(t, apierror.ErrNotFound, err.(apierror.APIError).Code)
686}
687
688func TestUpdateMatchingRule_Success(t *testing.T) {
689 db, mock, err := sqlmock.New()

Callers

nothing calls this directly

Calls 3

DeleteMatchingRuleMethod · 0.95
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected