Skip to content

Commit

Permalink
Test Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Oct 31, 2024
1 parent f90152c commit 46b6cbd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions regimes/mx/tax_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var (

// ValidateTaxIdentity validates a tax identity for SAT.
func ValidateTaxIdentity(tID *tax.Identity) error {
if tID == nil {
return nil
}
return validation.ValidateStruct(tID,
validation.Field(&tID.Code,
validation.By(ValidateTaxCode),
Expand Down
20 changes: 20 additions & 0 deletions regimes/mx/tax_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,20 @@ func TestTaxIdentityNormalization(t *testing.T) {
}
}

func TestNormalizeTaxIdentity(t *testing.T) {
t.Run("nil", func(t *testing.T) {
tID := (*tax.Identity)(nil)
assert.NotPanics(t, func() {
mx.NormalizeTaxIdentity(tID)
})
})
}

func TestTaxIdentityValidation(t *testing.T) {
t.Run("nil", func(t *testing.T) {
tID := (*tax.Identity)(nil)
assert.NoError(t, mx.Validate(tID))
})
tests := []struct {
name string
code cbc.Code
Expand Down Expand Up @@ -91,6 +104,13 @@ func TestTaxIdentityValidation(t *testing.T) {
}
}

func TestValidateTaxCode(t *testing.T) {
t.Run("empty", func(t *testing.T) {
err := mx.ValidateTaxCode("")
assert.NoError(t, err)
})
}

func TestTaxIdentityDetermineType(t *testing.T) {
tests := []struct {
Code cbc.Code
Expand Down

0 comments on commit 46b6cbd

Please sign in to comment.