-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcnpj_test.go
52 lines (48 loc) · 970 Bytes
/
cnpj_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
49
50
51
52
package docgen_test
import (
"testing"
"github.com/libercapital/helpers-go/docgen"
)
func TestSeedCNPJ(t *testing.T) {
tests := []struct {
name string
seed int64
want string
}{
{
name: "Should generate CNPJ with seed 2",
seed: 2,
want: "76352813000102",
},
{
name: "Should generate CNPJ with seed 123",
seed: 123,
want: "50782581000139",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := docgen.SeedCNPJ(tt.seed); got != tt.want {
t.Errorf("SeedCNPJ() = %v, want %v", got, tt.want)
}
})
}
}
func TestRandomCNPJ(t *testing.T) {
tests := []struct {
name string
}{
{
name: "Should generate random CNPJs",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
firstExec := docgen.RandomCNPJ()
secondExec := docgen.RandomCNPJ()
if firstExec == secondExec {
t.Errorf("SeedCNPJ() = firstExec %v, secondExec %v", firstExec, secondExec)
}
})
}
}