-
Notifications
You must be signed in to change notification settings - Fork 7
/
cnh_test.go
41 lines (34 loc) · 1.19 KB
/
cnh_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
package brdocs_test
import (
"github.com/brazanation/go-documents"
"github.com/brazanation/go-documents/internal/test"
"testing"
)
func TestCnhShouldBeValid(t *testing.T) {
cnh, err := brdocs.NewCnh("83592802666")
internal_test.AssertValidDocument(t, cnh, err)
}
func TestCnhShouldBeSameType(t *testing.T) {
cnh, _ := brdocs.NewCnh("83592802666")
internal_test.AssertDocumentType(t, cnh, brdocs.CnhType)
}
func TestCnhShouldBeFormatted(t *testing.T) {
cnh, err := brdocs.NewCnh("83592802666")
internal_test.AssertValidDocument(t, cnh, err)
internal_test.AssertDocumentFormatted(t, cnh, "83592802666")
}
func TestCnhShouldReturnErrorForRepeatedNumber(t *testing.T) {
number := "11111111111"
_, err := brdocs.NewCnh(number)
internal_test.AssertNotValidDocument(t, number, err, "Cnh(11111111111) is invalid")
}
func TestCnhShouldReturnErrorForInvalidNumber(t *testing.T) {
number := "83592802655"
_, err := brdocs.NewCnh(number)
internal_test.AssertNotValidDocument(t, number, err, "Cnh(83592802655) is invalid")
}
func TestCnhShouldReturnErrorForEmptyNumber(t *testing.T) {
number := ``
_, err := brdocs.NewCnh(number)
internal_test.AssertNotValidDocument(t, number, err, "Cnh must not be empty")
}