-
Notifications
You must be signed in to change notification settings - Fork 7
/
renavam_test.go
37 lines (30 loc) · 1.13 KB
/
renavam_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
package brdocs_test
import (
"github.com/brazanation/go-documents"
"github.com/brazanation/go-documents/internal/test"
"testing"
)
func TestRenavamShouldBeValid(t *testing.T) {
renavam, err := brdocs.NewRenavam("61855253306")
internal_test.AssertValidDocument(t, renavam, err)
}
func TestRenavamShouldBeFormatted(t *testing.T) {
renavam, err := brdocs.NewRenavam("73197444810")
internal_test.AssertValidDocument(t, renavam, err)
internal_test.AssertDocumentFormatted(t, renavam, "7319.744481-0")
}
func TestRenavamShouldReturnErrorForRepeatedNumber(t *testing.T) {
number := "11111111111"
_, err := brdocs.NewRenavam(number)
internal_test.AssertNotValidDocument(t, number, err, "Renavam(11111111111) is invalid")
}
func TestRenavamShouldReturnErrorForInvalidNumber(t *testing.T) {
number := "61855253307"
_, err := brdocs.NewRenavam(number)
internal_test.AssertNotValidDocument(t, number, err, "Renavam(61855253307) is invalid")
}
func TestRenavamShouldReturnErrorForEmptyNumber(t *testing.T) {
number := ``
_, err := brdocs.NewRenavam(number)
internal_test.AssertNotValidDocument(t, number, err, "Renavam must not be empty")
}