(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func 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 | |
| 226 | func TestValidateRecordTransaction(t *testing.T) { |
| 227 | tests := []struct { |
nothing calls this directly
no test coverage detected