-
Notifications
You must be signed in to change notification settings - Fork 0
/
go-aba_test.go
48 lines (39 loc) · 1.58 KB
/
go-aba_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package goAba_test
import (
"testing"
goAba "github.com/azaurus1/go-aba"
"gotest.tools/v3/assert"
)
// TODO: use testContainers to generate a fuzzed ABA file with https://github.com/flash-oss/aba-generator/
// then generate using goaba.Generate() and compare
func TestGenerate(t *testing.T) {
Header := goAba.Header{
Bank: "ANZ",
User: "Allowasa Pertolio Accounting&Tax",
UserNumber: "1234",
Description: "Credits Of The Wooloomooloo",
}
Transaction := goAba.Transaction{
BSB: "061021",
TransactionCode: goAba.Credit,
Account: "123456",
Amount: 12.0,
AccountTitle: "Georgian Council of New South Wales",
Reference: "Invoice # 1234",
TraceBSB: "061123",
TraceAccount: "1234567",
Remitter: "Bank LLC",
}
Footer := goAba.Footer{}
ABA := goAba.ABA{
Header: Header,
Transactions: []goAba.Transaction{Transaction},
Footer: Footer,
}
ABA.Generate()
assert.Equal(t, ABA.Header.ToString(), "0 01ANZ Allowasa Pertolio Accounti001234Credits Of T220524 ", "header string does not match")
for _, transaction := range ABA.Transactions {
assert.Equal(t, transaction.ToString(), "1061-021 123456 500000001200Georgian Council of New South WaInvoice # 1234 061-123 1234567Bank LLC 00000000", "transaction does not match")
}
assert.Equal(t, ABA.Footer.ToString(), "7999-999 000000120000000012000000000000 000001 ", "footer string does not match")
}