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

Function TestValidateRecordTransaction

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

Source from the content-addressed store, hash-verified

224}
225
226func TestValidateRecordTransaction(t *testing.T) {
227 tests := []struct {
228 name string
229 transaction RecordTransaction
230 wantErr bool
231 }{
232 {
233 name: "Valid Transaction",
234 transaction: RecordTransaction{
235 Amount: 100,
236 Currency: "USD",
237 Reference: "ref1",
238 Description: "Test transaction",
239 Source: "source1",
240 Destination: "dest1",
241 SkipQueue: true,
242 },
243 wantErr: false,
244 },
245 {
246 name: "Valid Transaction - Integer Precision",
247 transaction: RecordTransaction{
248 Amount: 50,
249 Precision: 1000,
250 Currency: "USD",
251 Reference: "ref_precision_int",
252 Description: "Integer precision transaction",
253 Source: "source1",
254 Destination: "dest1",
255 },
256 wantErr: false,
257 },
258 {
259 name: "Invalid Transaction - Non-integer Precision",
260 transaction: RecordTransaction{
261 Amount: 50,
262 Precision: 10.5,
263 Currency: "USD",
264 Reference: "ref_precision_float",
265 Description: "Fractional precision transaction",
266 Source: "source1",
267 Destination: "dest1",
268 },
269 wantErr: true,
270 },
271 {
272 name: "Invalid Transaction - Missing Required Fields",
273 transaction: RecordTransaction{
274 Amount: 100,
275 },
276 wantErr: true,
277 },
278 {
279 name: "Invalid Transaction - Invalid ScheduledFor",
280 transaction: RecordTransaction{
281 Amount: 100,
282 Currency: "USD",
283 Reference: "ref1",

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected