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

Function TestDeleteAccount_QueryError

database/account_test.go:300–313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func TestDeleteAccount_QueryError(t *testing.T) {
301 db, mock, err := sqlmock.New()
302 assert.NoError(t, err)
303 defer func() { _ = db.Close() }()
304
305 ds := Datasource{Conn: db}
306
307 mock.ExpectExec("DELETE FROM ledgerforge.accounts").
308 WithArgs("acc1").
309 WillReturnError(fmt.Errorf("database error"))
310
311 err = ds.DeleteAccount("acc1")
312 assert.Error(t, err)
313}

Callers

nothing calls this directly

Calls 3

DeleteAccountMethod · 0.95
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected