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

Function TestValidateCreateAccount

api/model/model_test.go:186–224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestValidateCreateAccount(t *testing.T) {
187 tests := []struct {
188 name string
189 account CreateAccount
190 wantErr bool
191 }{
192 {
193 name: "Valid Account with LedgerId",
194 account: CreateAccount{LedgerId: "ledger1", IdentityId: "identity1", Currency: "USD"},
195 wantErr: false,
196 },
197 {
198 name: "Valid Account with BalanceId",
199 account: CreateAccount{BalanceId: "balance1"},
200 wantErr: false,
201 },
202 {
203 name: "Invalid Account - Missing Required Fields",
204 account: CreateAccount{},
205 wantErr: true,
206 },
207 {
208 name: "Invalid Account - Both LedgerId and BalanceId",
209 account: CreateAccount{LedgerId: "ledger1", BalanceId: "balance1", IdentityId: "identity1", Currency: "USD"},
210 wantErr: true,
211 },
212 }
213
214 for _, tt := range tests {
215 t.Run(tt.name, func(t *testing.T) {
216 err := tt.account.ValidateCreateAccount()
217 if tt.wantErr {
218 assert.Error(t, err)
219 } else {
220 assert.NoError(t, err)
221 }
222 })
223 }
224}
225
226func TestValidateRecordTransaction(t *testing.T) {
227 tests := []struct {

Callers

nothing calls this directly

Calls 2

ValidateCreateAccountMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected