validation-br 2.0.0-next-1 → 2.0.0-next-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/test/carplate.spec.js +26 -86
  2. package/dist/test/carplate.spec.js.map +1 -1
  3. package/dist/test/cep.spec.d.ts +2 -0
  4. package/dist/test/cep.spec.d.ts.map +1 -0
  5. package/dist/test/cep.spec.js +95 -0
  6. package/dist/test/cep.spec.js.map +1 -0
  7. package/dist/test/cnh.spec.js +13 -18
  8. package/dist/test/cnh.spec.js.map +1 -1
  9. package/dist/test/phone.spec.js +15 -3
  10. package/dist/test/phone.spec.js.map +1 -1
  11. package/dist/tsconfig.tsbuildinfo +1 -1
  12. package/package.json +1 -1
  13. package/test/carplate.spec.ts +36 -112
  14. package/test/cep.spec.ts +127 -0
  15. package/test/cnh.spec.ts +18 -22
  16. package/test/phone.spec.ts +20 -8
  17. package/todo.md +17 -3
  18. package/dist/test/_helpers/array_random.spec.d.ts +0 -2
  19. package/dist/test/_helpers/array_random.spec.d.ts.map +0 -1
  20. package/dist/test/_helpers/array_random.spec.js +0 -13
  21. package/dist/test/_helpers/array_random.spec.js.map +0 -1
  22. package/dist/test/utils-applyMask.test.d.ts +0 -2
  23. package/dist/test/utils-applyMask.test.d.ts.map +0 -1
  24. package/dist/test/utils-applyMask.test.js +0 -18
  25. package/dist/test/utils-applyMask.test.js.map +0 -1
  26. package/dist/test/utils-fakeNumber.test.d.ts +0 -2
  27. package/dist/test/utils-fakeNumber.test.d.ts.map +0 -1
  28. package/dist/test/utils-fakeNumber.test.js +0 -24
  29. package/dist/test/utils-fakeNumber.test.js.map +0 -1
  30. package/dist/test/utils-randomLetter.test.d.ts +0 -2
  31. package/dist/test/utils-randomLetter.test.d.ts.map +0 -1
  32. package/dist/test/utils-randomLetter.test.js +0 -14
  33. package/dist/test/utils-randomLetter.test.js.map +0 -1
  34. package/test/_helpers/array_random.spec.ts +0 -12
  35. package/test/utils-applyMask.test.ts +0 -17
  36. package/test/utils-fakeNumber.test.ts +0 -28
  37. package/test/utils-randomLetter.test.ts +0 -14
@@ -1,9 +1,8 @@
1
- import { CarPlate } from '../src/carplate'
1
+ import { CarPlate } from '../src/carplate';
2
2
  import { isCarPlate } from '../src/main';
3
3
 
4
4
  describe('CarPlate', () => {
5
5
  describe('construtor', () => {
6
-
7
6
  test.each([
8
7
  'AAA0000',
9
8
  'AAA-0000',
@@ -13,7 +12,7 @@ describe('CarPlate', () => {
13
12
  'abc-0h00',
14
13
  'abc-0h00 ',
15
14
  ])('A placa %s deve ser válida', (input) => {
16
- expect(new CarPlate(input)).toBeDefined()
15
+ expect(new CarPlate(input)).toBeDefined();
17
16
  });
18
17
 
19
18
  test.each([
@@ -26,12 +25,11 @@ describe('CarPlate', () => {
26
25
  null,
27
26
  undefined,
28
27
  ])('A placa %s deve lançar erro', (input) => {
29
- expect(() => new CarPlate(input as any)).toThrow()
30
- })
31
- })
28
+ expect(() => new CarPlate(input as any)).toThrow();
29
+ });
30
+ });
32
31
 
33
32
  describe('isCarPlate', () => {
34
-
35
33
  test.each([
36
34
  'AAA0000',
37
35
  'AAA-0000',
@@ -40,7 +38,7 @@ describe('CarPlate', () => {
40
38
  'AbA0F00',
41
39
  'abc-0h00',
42
40
  ])('A placa %s deve ser válida', (clarPlate) => {
43
- expect(isCarPlate(clarPlate)).toBeTruthy()
41
+ expect(isCarPlate(clarPlate)).toBeTruthy();
44
42
  });
45
43
 
46
44
  test.each([
@@ -52,110 +50,36 @@ describe('CarPlate', () => {
52
50
  null,
53
51
  undefined,
54
52
  ])('A placa %s não deve ser válida', (clarPlate) => {
55
- expect(isCarPlate(clarPlate as any)).toBeFalsy()
56
- })
57
- })
58
-
59
- // describe('validate', () => {
60
-
61
- // test.each([
62
- // 'AAA0000',
63
- // 'AAA-0000',
64
- // 'AAA0F00',
65
- // 'AAA-0F00',
66
- // 'AbA0F00',
67
- // 'abc-0h00',
68
- // ])('A placa %s deve ser válida', (clarPlate) => {
69
- // expect(validate(clarPlate)).toBeTruthy()
70
- // });
71
-
72
- // test.each([
73
- // 'A2A0000',
74
- // 'AAA-00A0',
75
- // 'AAA0F0',
76
- // 'AAA0F077',
77
- // '',
78
- // null,
79
- // undefined,
80
- // ])('A placa %s não deve ser válida', (clarPlate) => {
81
- // // @ts-ignore
82
- // expect(validate(clarPlate)).toBeFalsy()
83
- // })
84
- // })
85
-
86
-
87
- // describe('validateOrFail', () => {
88
-
89
- // test.each([
90
- // 'AAA0000',
91
- // 'AAA-0000',
92
- // 'AAA0F00',
93
- // 'AAA-0F00',
94
- // 'AbA0F00',
95
- // 'abc-0h00',
96
- // ])('A placa %s deve ser válida', (clarPlate) => {
97
- // expect(validateOrFail(clarPlate)).toBeTruthy()
98
- // });
99
-
100
- // test.each([
101
- // 'A2A0000',
102
- // 'AAA-00A0',
103
- // 'AAA0F0',
104
- // 'AAA0F077',
105
- // '',
106
- // null,
107
- // undefined,
108
- // ])('A placa %s não deve ser válida', (clarPlate) => {
109
- // // @ts-ignore
110
- // expect(()=>validateOrFail(clarPlate)).toThrow()
111
- // })
112
- // })
113
-
114
-
115
- // describe('DV', () => {
116
-
117
- // test('Car plate não tem DV', () => {
118
- // expect(dv('AAA0000')).toBeNull()
119
- // expect(checksum('AAA0000')).toBeNull()
120
- // })
121
- // })
122
-
123
- // describe('fake', () => {
124
-
125
- // test('Gera fakes sem mascara', () => {
126
- // for (let i = 0; i <= 20; i++) {
127
- // const carPlate = fake()
128
-
129
-
130
- // expect(validate(carPlate)).toBeTruthy()
131
- // expect(carPlate.length).toBe(7)
132
- // }
133
- // })
53
+ expect(isCarPlate(clarPlate as any)).toBeFalsy();
54
+ });
55
+ });
134
56
 
135
- // test('Gera fakes com mascara', () => {
136
- // for (let i = 0; i <= 20; i++) {
137
- // const carPlate = fake(true)
138
- // expect(validate(carPlate)).toBeTruthy()
139
- // expect(carPlate.length).toBe(8)
140
- // }
141
- // })
142
- // })
57
+ describe('checlsum', () => {
58
+ test('Car plate não tem DV', () => {
59
+ expect(() => CarPlate.checksum('MYN-7442'));
60
+ });
61
+ });
143
62
 
144
- // describe('mask', () => {
63
+ describe('fake', () => {
64
+ test.each([...Array(5)])('Gera fakes sem mascara', () => {
65
+ expect(CarPlate.fake()).toBeDefined();
66
+ });
67
+ });
145
68
 
146
- // test.each([
147
- // 'AAA0000',
148
- // 'AAA0900',
149
- // 'AAA0F00',
150
- // 'AGA0F00',
151
- // 'aba0F00',
152
- // 'abc0h00',
153
- // ])('A placa %s deve ser válida', (clarPlate) => {
154
- // const masked = mask(clarPlate)
155
- // expect(masked).toBeDefined()
156
- // expect(masked).toBe(masked.toLocaleUpperCase())
157
- // expect(masked.length).toBe(8)
158
- // expect(masked).toMatch(/^[A-Z]{3}-[0-9][A-Z0-9][0-9]{2}$/)
159
- // })
160
- // })
161
- })
69
+ describe('mask', () => {
70
+ test.each([
71
+ 'AAA0000',
72
+ 'AAA0900',
73
+ 'AAA0F00',
74
+ 'AGA0F00',
75
+ 'aba0F00',
76
+ 'abc0h00',
77
+ ])('A placa %s deve ser válida', (clarPlate) => {
78
+ const masked = new CarPlate(clarPlate).mask();
79
+ expect(masked).toBeDefined();
80
+ expect(masked).toBe(masked.toLocaleUpperCase());
81
+ expect(masked.length).toBe(8);
82
+ expect(masked).toMatch(/^[A-Z]{3}-[0-9][A-Z0-9][0-9]{2}$/);
83
+ });
84
+ });
85
+ });
@@ -0,0 +1,127 @@
1
+ import { CEP } from '../src/cep';
2
+ import { UF } from '../src/uf';
3
+
4
+ describe('CEP', () => {
5
+ describe('constructor', () => {
6
+ test.each(['59650000', '59650-000', '59.650-000'])(
7
+ '%s deve estar definido',
8
+ (input) => {
9
+ expect(new CEP(input)).toBeDefined();
10
+ }
11
+ );
12
+
13
+ test.each([
14
+ '5965000A', // letras
15
+ '596000', // caracteres de menos
16
+ '596500000', // caracteres de mais
17
+ '5965-0000', // hífen fora do lugar
18
+ '59.650000', // tem ponto mas não tem traço
19
+ ])('%s deve lançar erro', (input) => {
20
+ expect(() => new CEP(input)).toThrow();
21
+ });
22
+ });
23
+
24
+ describe('constructor com validação por estado', () => {
25
+ test.each(['59650000', '59650-000', '59.650-000'])(
26
+ '%s deve estar definido',
27
+ (input) => {
28
+ expect(new CEP(input, { uf: UF.RN })).toBeDefined();
29
+ }
30
+ );
31
+
32
+ test.each(['59650000', '59650-000', '59.650-000'])(
33
+ '%s deve lançar erro pois não é um CEP do Ceará',
34
+ (input) => {
35
+ expect(() => new CEP(input, { uf: UF.CE })).toThrow();
36
+ }
37
+ );
38
+ });
39
+
40
+ describe('toString', () => {
41
+ test.each(['59650000', '59650-000'])(
42
+ 'CEP %s deve ser exibido sem máscara',
43
+ (value) => {
44
+ expect(new CEP(value).toString()).toBe('59650000');
45
+ expect(new CEP(value).value).toBe('59650000');
46
+ }
47
+ );
48
+ });
49
+
50
+ describe('fake', () => {
51
+ test.each([...Array(5)])('Gera fake válido', () => {
52
+ const cep = CEP.fake();
53
+ expect(cep).toBeDefined();
54
+ expect(cep.value).toHaveLength(8);
55
+ });
56
+ });
57
+
58
+ describe('checksum', () => {
59
+ test('deve lançar erro pois cep não tem dígito verificador', () => {
60
+ expect(() => CEP.checksum('59650000')).toThrow();
61
+ });
62
+ });
63
+
64
+ describe('mask', () => {
65
+ test.each([
66
+ { value: '95471143', expected: '95471-143' },
67
+ { value: '16474534', expected: '16474-534' },
68
+ { value: '44471146', expected: '44471-146' },
69
+ ])('%s deve gerar máscara corretamente', (input) => {
70
+ const cep = new CEP(input.value);
71
+
72
+ expect(cep.mask()).toBe(input.expected);
73
+ expect(cep.mask()).toHaveLength(9);
74
+ expect(cep.mask()).toMatch(/^\d{5}-\d{3}$/);
75
+ });
76
+ });
77
+
78
+ //
79
+ //
80
+ //
81
+ // SPECIFIC
82
+ //
83
+ //
84
+ //
85
+
86
+ describe('getUFByCEP', () => {
87
+ test.each(['59650000', '59650-000', '59.650-000'])(
88
+ 'O CEP de Assú deve retornar RN',
89
+ (item) => {
90
+ const uf = CEP.getUFByCEP(item);
91
+ expect(uf).toBeDefined();
92
+ expect(uf).toBeInstanceOf(UF);
93
+ expect(uf.value).toBe('RN');
94
+ }
95
+ );
96
+
97
+ test.each(['01123456', '01123-456', '01.123-456'])(
98
+ 'Verifica CEPs de São Paulo para testar o "0" inicial',
99
+ (item) => {
100
+ const uf = CEP.getUFByCEP(item);
101
+ expect(uf).toBeDefined();
102
+ expect(uf).toBeInstanceOf(UF);
103
+ expect(uf.value).toBe('SP');
104
+ }
105
+ );
106
+ });
107
+
108
+ describe('getRandomByUF', () => {
109
+ test('Deve gerar um CEP aleatório dentro da faixa do RN', () => {
110
+ const cep = CEP.getRandomByUF(UF.RN);
111
+ expect(cep).toBeDefined();
112
+ expect(cep.value >= '59000000').toBeTruthy();
113
+ expect(cep.value <= '59999999').toBeTruthy();
114
+ });
115
+ });
116
+
117
+ describe('getRangesByUF', () => {
118
+ test.each(['59650000', '59650-000', '59.650-000'])(
119
+ 'Pega as faixas do RN',
120
+ () => {
121
+ const [ranges] = CEP.getRangesByUF(UF.RN);
122
+ expect(ranges).toBeDefined();
123
+ expect(ranges).toMatchObject(['59000000', '59999999']);
124
+ }
125
+ );
126
+ });
127
+ });
package/test/cnh.spec.ts CHANGED
@@ -3,26 +3,22 @@ import * as _cnh from '../src/cnh';
3
3
 
4
4
  describe('CNH', () => {
5
5
  describe('constructor', () => {
6
- test.each([
7
- '50195131143',
8
- '58316794534',
9
- '50195471165',
10
- '69044271146',
11
- '46190906839',
12
- '624729276-37',
13
- ])('deve estar definido', (input) => {
14
- expect(new CNH(input)).toBeDefined();
15
- });
6
+ test.each(['14490435923', '97286888262', '621049358-60', '491872350-50'])(
7
+ 'deve estar definido',
8
+ (input) => {
9
+ expect(new CNH(input)).toBeDefined();
10
+ }
11
+ );
16
12
 
17
13
  test.each([
18
- '50195131143',
19
- '58316794534',
20
- '50195471165',
21
- '69044271146',
22
- '46190906839',
23
- '624729276-37',
14
+ '50995131143',
15
+ '58916794534',
16
+ '50995471165',
17
+ '69944271146',
18
+ '46990906839',
19
+ '629729276-37',
24
20
  ])('deve lançar erro', (input) => {
25
- expect(new CNH(input)).toBeDefined();
21
+ expect(() => new CNH(input)).toThrow();
26
22
  });
27
23
  });
28
24
 
@@ -46,26 +42,26 @@ describe('CNH', () => {
46
42
  expect(typeof calcDv).toBe('string');
47
43
  });
48
44
 
49
-
50
45
  test.each(['50195471', '5831641745', ''])(
51
46
  'deve lançar erro de dv',
52
47
  (item) => {
53
48
  expect(() => CNH.checksum(item)).toThrow();
54
49
  }
55
50
  );
56
-
57
51
  });
58
52
 
59
53
  describe('mask', () => {
60
54
  test.each([
61
- { value: '50195471143', expected: '501954711-43' },
62
- { value: '58316474534', expected: '583164745-34' },
63
- { value: '69044471146', expected: '690444711-46' },
55
+ { value: '14490435923', expected: '144904359-23' },
56
+ { value: '97286888262', expected: '972868882-62' },
57
+ { value: '621049358-60', expected: '621049358-60' },
58
+ { value: '491872350-50', expected: '491872350-50' },
64
59
  ])('máscara deve ser gerada corretamente', (input) => {
65
60
  const cnh = new CNH(input.value);
66
61
 
67
62
  expect(cnh.mask()).toBe(input.expected);
68
63
  expect(cnh.mask()).toHaveLength(12);
64
+ expect(cnh.mask()).toMatch(/^\d{9}-\d{2}$/)
69
65
  });
70
66
  });
71
67
  });
@@ -1,7 +1,19 @@
1
1
  import { Phone } from '../src/phone';
2
2
 
3
- const cellPhones = ['+5584999580685', '+55 84 9 9958 0685', '+55 (84) 9 9958-0685', '+55 (84) 99958-0685', '84 99958-0685'];
4
- const phones = ['+558433311454', '84 3331-1454', '84 3331 1454', '(84) 3331 1454', '84-3331-1454'];
3
+ const cellPhones = [
4
+ '+5584999580685',
5
+ '+55 84 9 9958 0685',
6
+ '+55 (84) 9 9958-0685',
7
+ '+55 (84) 99958-0685',
8
+ '84 99958-0685',
9
+ ];
10
+ const phones = [
11
+ '+558433311454',
12
+ '84 3331-1454',
13
+ '84 3331 1454',
14
+ '(84) 3331 1454',
15
+ '84-3331-1454',
16
+ ];
5
17
 
6
18
  describe('Phone', () => {
7
19
  describe('constructor', () => {
@@ -30,7 +42,7 @@ describe('Phone', () => {
30
42
  expect(fake).toBeDefined();
31
43
  });
32
44
 
33
- test.each([...Array(5)])('Cria um fake com DDD 11', () => {
45
+ test.each([...Array(50)])('Cria um fake com DDD 11', () => {
34
46
  const fake = Phone.fake({ ddd: '11' });
35
47
  expect(fake).toBeDefined();
36
48
  expect(fake.ddd).toBe('11');
@@ -39,15 +51,15 @@ describe('Phone', () => {
39
51
  test.each([...Array(5)])('Cria um fake com isMobile=true', () => {
40
52
  const fake = Phone.fake({ isMobile: true });
41
53
  expect(fake).toBeDefined();
42
- expect(fake.isMobile).toBeTruthy()
43
- expect(fake.phone.length).toBe(9)
54
+ expect(fake.isMobile).toBeTruthy();
55
+ expect(fake.phone.length).toBe(9);
44
56
  });
45
57
 
46
58
  test.each([...Array(5)])('Cria um fake com isLandline=true', () => {
47
- const fake = Phone.fake({ isLandline: true });
59
+ const fake = Phone.fake({ isLandline: true });
48
60
  expect(fake).toBeDefined();
49
- expect(fake.isMobile).toBeFalsy()
50
- expect(fake.phone.length).toBe(8)
61
+ expect(fake.isMobile).toBeFalsy();
62
+ expect(fake.phone.length).toBe(8);
51
63
  });
52
64
  });
53
65
 
package/todo.md CHANGED
@@ -5,13 +5,27 @@
5
5
  - https://github.com/VitorLuizC/brazilian-values/blob/master/src/validators/isPhone.ts
6
6
  - https://github.com/VitorLuizC/brazilian-values/blob/master/src/validators/isDDD.ts
7
7
 
8
- - [ ] Conta bancária
8
+ - ~~[ ] Conta bancária~~
9
9
 
10
- - [ ] isPixKey - verifica se é um dos tipos de chaves
10
+ - [x] isPixKey - verifica se é um dos tipos de chaves
11
11
 
12
+ - [x] isPixCopyPaste - verifica se é um dos tipos de chaves
12
13
 
13
- - [ ] isCEP
14
+
15
+ - [x] isCEP
14
16
  - https://github.com/ogilvieira/validator-brasil/blob/main/src/isCEP.ts
17
+ - @klawdyo/qrdapio
18
+
19
+ - [x] isUF
20
+ - @klawdyo/qrdapio
21
+
22
+ - isBoleto
23
+ - Construtor pode receber linha digitável
24
+ - Pra receber o código de barras, use o static fromBarcode()
25
+ - mask() pode devolver a linha digitável ou o código de barras. Por padrão, a linha digitável
26
+ - toString() devolve a linha digitável
27
+ - toBarcode() devolve a linha digitável
28
+ - parse() é chamado no início e já separa as partes
15
29
 
16
30
  - [ ] isCAEPF
17
31
  - https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/caepf/legislacao
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=array_random.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array_random.spec.d.ts","sourceRoot":"","sources":["../../../test/_helpers/array_random.spec.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const array_random_1 = require("../../src/_helpers/array_random");
4
- describe('arrayRandom()', () => {
5
- describe('Testa se o valor escolhido está dentro da lista', () => {
6
- test.each([...Array(20)])('Testa se está no array', () => {
7
- const list = [1, 2, 3, 4];
8
- const selected = (0, array_random_1.arrayRandom)(list);
9
- expect(list).toContain(selected);
10
- });
11
- });
12
- });
13
- //# sourceMappingURL=array_random.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array_random.spec.js","sourceRoot":"","sources":["../../../test/_helpers/array_random.spec.ts"],"names":[],"mappings":";;AAAA,kEAA6D;AAG7D,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC/D,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,GAAG,EAAE;YACvD,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YACzB,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,IAAI,CAAC,CAAA;YAClC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils-applyMask.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-applyMask.test.d.ts","sourceRoot":"","sources":["../../test/utils-applyMask.test.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../src/utils");
4
- describe('applyMask()', () => {
5
- const items = [
6
- { value: '123456', mask: '00000-0', expected: '12345-6' },
7
- { value: '12345', mask: '00000-0', expected: '01234-5' },
8
- { value: '123456789', mask: '00000-0', expected: '12345-6' },
9
- { value: 123456789, mask: '00000-0', expected: '12345-6' },
10
- ];
11
- test('Máscara deve ser aplicada com o valor e tamanho correto', () => {
12
- items.forEach((item) => {
13
- expect(item.expected.length).toBe(item.mask.length);
14
- expect((0, utils_1.applyMask)(item.value, item.mask)).toBe(item.expected);
15
- });
16
- });
17
- });
18
- //# sourceMappingURL=utils-applyMask.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-applyMask.test.js","sourceRoot":"","sources":["../../test/utils-applyMask.test.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AAExC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,KAAK,GAAG;QACZ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;QACzD,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;QACxD,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;QAC5D,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;KAC3D,CAAA;IAED,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACnD,MAAM,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils-fakeNumber.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-fakeNumber.test.d.ts","sourceRoot":"","sources":["../../test/utils-fakeNumber.test.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../src/utils");
4
- describe('fakeNumber()', () => {
5
- test.each([...Array(10)])('forceLength = true', () => {
6
- const num = (0, utils_1.fakeNumber)(4, true);
7
- expect(num).toHaveLength(4);
8
- expect(typeof num).toBe('string');
9
- expect(num).toMatch(/^[\d]+$/);
10
- });
11
- test.each([...Array(10)])('forceLength = false', () => {
12
- const num = (0, utils_1.fakeNumber)(4);
13
- expect(+num).toBeLessThanOrEqual(9999);
14
- expect(+num).toBeGreaterThanOrEqual(0);
15
- expect(typeof num).toBe('string');
16
- });
17
- test.each([...Array(10)])('isAlpha = true', () => {
18
- const num = (0, utils_1.fakeNumber)(4, true, true);
19
- expect(num).toHaveLength(4);
20
- expect(typeof num).toBe('string');
21
- expect(num).toMatch(/^[0-9A-Z]+$/);
22
- });
23
- });
24
- //# sourceMappingURL=utils-fakeNumber.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-fakeNumber.test.js","sourceRoot":"","sources":["../../test/utils-fakeNumber.test.ts"],"names":[],"mappings":";;AAAA,wCAAyC;AAEzC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,GAAG,EAAE;QACnD,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QAE/B,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QAC3B,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpD,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAA;QAEzB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACtC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAGF,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/C,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAErC,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QAC3B,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils-randomLetter.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-randomLetter.test.d.ts","sourceRoot":"","sources":["../../test/utils-randomLetter.test.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../src/utils");
4
- describe('randomLetter()', () => {
5
- test('forceLength = false', () => {
6
- const list = [...Array(1000)];
7
- list.forEach(() => {
8
- const letter = (0, utils_1.randomLetter)();
9
- expect(letter).toMatch(/^[A-Z]{1}$/);
10
- expect(typeof letter).toBe('string');
11
- });
12
- });
13
- });
14
- //# sourceMappingURL=utils-randomLetter.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-randomLetter.test.js","sourceRoot":"","sources":["../../test/utils-randomLetter.test.ts"],"names":[],"mappings":";;AAAA,wCAA2C;AAE3C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC/B,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QAE7B,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,MAAM,MAAM,GAAG,IAAA,oBAAY,GAAE,CAAA;YAE7B,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;YACpC,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,12 +0,0 @@
1
- import { arrayRandom } from "../../src/_helpers/array_random"
2
-
3
-
4
- describe('arrayRandom()', () => {
5
- describe('Testa se o valor escolhido está dentro da lista', () => {
6
- test.each([...Array(20)])('Testa se está no array', () => {
7
- const list = [1, 2, 3, 4]
8
- const selected = arrayRandom(list)
9
- expect(list).toContain(selected)
10
- })
11
- })
12
- })
@@ -1,17 +0,0 @@
1
- import { applyMask } from '../src/utils'
2
-
3
- describe('applyMask()', () => {
4
- const items = [
5
- { value: '123456', mask: '00000-0', expected: '12345-6' },
6
- { value: '12345', mask: '00000-0', expected: '01234-5' },
7
- { value: '123456789', mask: '00000-0', expected: '12345-6' },
8
- { value: 123456789, mask: '00000-0', expected: '12345-6' },
9
- ]
10
-
11
- test('Máscara deve ser aplicada com o valor e tamanho correto', () => {
12
- items.forEach((item) => {
13
- expect(item.expected.length).toBe(item.mask.length)
14
- expect(applyMask(item.value, item.mask)).toBe(item.expected)
15
- })
16
- })
17
- })
@@ -1,28 +0,0 @@
1
- import { fakeNumber } from'../src/utils'
2
-
3
- describe('fakeNumber()', () => {
4
- test.each([...Array(10)])('forceLength = true', () => {
5
- const num = fakeNumber(4, true)
6
-
7
- expect(num).toHaveLength(4)
8
- expect(typeof num).toBe('string')
9
- expect(num).toMatch(/^[\d]+$/)
10
- })
11
-
12
- test.each([...Array(10)])('forceLength = false', () => {
13
- const num = fakeNumber(4)
14
-
15
- expect(+num).toBeLessThanOrEqual(9999)
16
- expect(+num).toBeGreaterThanOrEqual(0)
17
- expect(typeof num).toBe('string')
18
- })
19
-
20
-
21
- test.each([...Array(10)])('isAlpha = true', () => {
22
- const num = fakeNumber(4, true, true)
23
-
24
- expect(num).toHaveLength(4)
25
- expect(typeof num).toBe('string')
26
- expect(num).toMatch(/^[0-9A-Z]+$/)
27
- })
28
- })