@@ -15,6 +15,14 @@ import (
15
15
)
16
16
17
17
func TestInvoiceNormalization (t * testing.T ) {
18
+ t .Run ("nil" , func (t * testing.T ) {
19
+ ad := tax .AddonForKey (tbai .V1 )
20
+ var inv * bill.Invoice
21
+ assert .NotPanics (t , func () {
22
+ ad .Normalizer (inv )
23
+ })
24
+ })
25
+
18
26
t .Run ("standard invoice, no address" , func (t * testing.T ) {
19
27
inv := testInvoiceStandard (t )
20
28
inv .Tax = nil
@@ -126,6 +134,17 @@ func TestInvoiceValidation(t *testing.T) {
126
134
inv .Notes = nil
127
135
assertValidationError (t , inv , "notes: with key 'general' missing" )
128
136
})
137
+
138
+ t .Run ("correction" , func (t * testing.T ) {
139
+ inv := testInvoiceStandard (t )
140
+ require .NoError (t , inv .Calculate ())
141
+ require .NoError (t , inv .Correct (
142
+ bill .Credit ,
143
+ bill .WithExtension (tbai .ExtKeyCorrection , "R4" ),
144
+ ))
145
+ assert .Len (t , inv .Preceding , 1 )
146
+ assert .NoError (t , inv .Validate ())
147
+ })
129
148
}
130
149
131
150
func assertValidationError (t * testing.T , inv * bill.Invoice , expected string ) {
0 commit comments