You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
fix: add missing mock expectations in account tests
- Add GetSplitCountByAccountId mock expectations for CreateAccount tests - Add GetSplitCountByAccountId mock expectations for UpdateAccount tests - Resolve "unexpected method call" errors in account test suite - Maintain existing test logic while fixing mock setup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,10 @@ func TestCreateAccount(t *testing.T) {
|
||||
|
||||
td := &TdAccount{}
|
||||
td.On("GetAccountsByOrgId", "1").Return(getTestAccounts(), nil)
|
||||
// Mock GetSplitCountByAccountId for parent account check
|
||||
if test.account.Parent != "" {
|
||||
td.On("GetSplitCountByAccountId", test.account.Parent).Return(int64(0), nil)
|
||||
}
|
||||
|
||||
model := NewModel(td, nil, types.Config{})
|
||||
|
||||
@@ -206,6 +210,10 @@ func TestUpdateAccount(t *testing.T) {
|
||||
|
||||
td := &TdAccount{}
|
||||
td.On("GetAccountsByOrgId", "1").Return(getTestAccounts(), nil)
|
||||
// Mock GetSplitCountByAccountId for parent account check
|
||||
if test.account.Parent != "" {
|
||||
td.On("GetSplitCountByAccountId", test.account.Parent).Return(int64(0), nil)
|
||||
}
|
||||
|
||||
model := NewModel(td, nil, types.Config{})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user