test: add finance handler, service, repository tests
All checks were successful
CI / ci (push) Successful in 36s
All checks were successful
CI / ci (push) Successful in 36s
This commit is contained in:
24
internal/repository/finance_test.go
Normal file
24
internal/repository/finance_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewFinanceRepository(t *testing.T) {
|
||||
repo := NewFinanceRepository(nil)
|
||||
if repo == nil {
|
||||
t.Error("expected non-nil FinanceRepository")
|
||||
}
|
||||
if repo.db != nil {
|
||||
t.Error("expected nil db")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFinanceCategoryErrors(t *testing.T) {
|
||||
if ErrFinanceCategoryNotFound.Error() != "finance category not found" {
|
||||
t.Errorf("unexpected error message: %s", ErrFinanceCategoryNotFound.Error())
|
||||
}
|
||||
if ErrFinanceTransactionNotFound.Error() != "finance transaction not found" {
|
||||
t.Errorf("unexpected error message: %s", ErrFinanceTransactionNotFound.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user