@sankhyalabs/core 6.0.1 → 6.1.0-dev.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 (71) hide show
  1. package/.docs/classes/Change.md +11 -11
  2. package/.docs/classes/DataUnit.md +230 -122
  3. package/.docs/classes/FieldComparator.md +6 -2
  4. package/.docs/classes/KeyboardManager.md +99 -9
  5. package/.docs/classes/LockManager.md +4 -4
  6. package/.docs/classes/ObjectUtils.md +50 -2
  7. package/.docs/classes/SelectionInfo.md +12 -12
  8. package/.docs/classes/StringUtils.md +10 -10
  9. package/.docs/enumerations/Action.md +41 -31
  10. package/.docs/enumerations/ChangeOperation.md +4 -4
  11. package/.docs/enumerations/SelectionMode.md +2 -2
  12. package/.docs/enumerations/UserInterface.md +15 -5
  13. package/.docs/interfaces/DUActionInterceptor.md +1 -1
  14. package/.docs/interfaces/PageRequest.md +3 -3
  15. package/.docs/interfaces/QuickFilter.md +3 -3
  16. package/.docs/interfaces/Record.md +4 -4
  17. package/.docs/interfaces/SavedRecord.md +5 -5
  18. package/.docs/interfaces/WaitingChange.md +3 -3
  19. package/.docs/type-aliases/DataUnitEventOptions.md +1 -1
  20. package/dist/dataunit/DataUnit.d.ts +19 -0
  21. package/dist/dataunit/DataUnit.js +43 -3
  22. package/dist/dataunit/DataUnit.js.map +1 -1
  23. package/dist/dataunit/formatting/PrettyFormatter.js +8 -3
  24. package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
  25. package/dist/dataunit/metadata/DataType.d.ts +1 -1
  26. package/dist/dataunit/metadata/DataType.js +7 -4
  27. package/dist/dataunit/metadata/DataType.js.map +1 -1
  28. package/dist/dataunit/metadata/UnitMetadata.d.ts +1 -0
  29. package/dist/dataunit/metadata/UnitMetadata.js +1 -0
  30. package/dist/dataunit/metadata/UnitMetadata.js.map +1 -1
  31. package/dist/dataunit/sorting/FieldComparator.d.ts +2 -2
  32. package/dist/dataunit/sorting/FieldComparator.js +4 -4
  33. package/dist/dataunit/sorting/FieldComparator.js.map +1 -1
  34. package/dist/dataunit/state/action/DataUnitAction.d.ts +1 -0
  35. package/dist/dataunit/state/action/DataUnitAction.js +1 -0
  36. package/dist/dataunit/state/action/DataUnitAction.js.map +1 -1
  37. package/dist/utils/KeyboardManager/index.d.ts +9 -0
  38. package/dist/utils/KeyboardManager/index.js +45 -1
  39. package/dist/utils/KeyboardManager/index.js.map +1 -1
  40. package/dist/utils/KeyboardManager/interface.d.ts +1 -0
  41. package/dist/utils/LockManager.js.map +1 -1
  42. package/dist/utils/ObjectUtils.d.ts +14 -0
  43. package/dist/utils/ObjectUtils.js +20 -0
  44. package/dist/utils/ObjectUtils.js.map +1 -1
  45. package/dist/utils/SortingUtils.js +9 -1
  46. package/dist/utils/SortingUtils.js.map +1 -1
  47. package/dist/utils/StringUtils.js +12 -6
  48. package/dist/utils/StringUtils.js.map +1 -1
  49. package/package.json +1 -1
  50. package/reports/test-report.xml +669 -124
  51. package/src/dataunit/DataUnit.ts +51 -3
  52. package/src/dataunit/formatting/PrettyFormatter.ts +8 -5
  53. package/src/dataunit/metadata/DataType.ts +8 -4
  54. package/src/dataunit/metadata/UnitMetadata.ts +1 -0
  55. package/src/dataunit/sorting/FieldComparator.ts +4 -4
  56. package/src/dataunit/state/action/DataUnitAction.ts +2 -0
  57. package/src/utils/KeyboardManager/index.ts +57 -0
  58. package/src/utils/KeyboardManager/interface.ts +1 -0
  59. package/src/utils/LockManager.ts +0 -1
  60. package/src/utils/ObjectUtils.ts +21 -0
  61. package/src/utils/SortingUtils.ts +10 -1
  62. package/src/utils/StringUtils.ts +10 -6
  63. package/test/dataunit/formatting/PrettyFormatter.spec.ts +1 -1
  64. package/test/testCases/NumberUtilsTestCases.ts +190 -0
  65. package/test/testCases/StringUtilsTestCases.ts +435 -0
  66. package/test/testCases/TimeFormatterTestUtils.ts +43 -0
  67. package/test/util/NumberUtils.spec.ts +72 -150
  68. package/test/util/ObjectUtils.spec.ts +572 -0
  69. package/test/util/StringUtils.spec.ts +260 -36
  70. package/test/util/TimeFormatter.spec.ts +65 -18
  71. package/src/utils/test/objectUtils.spec.ts +0 -109
@@ -0,0 +1,435 @@
1
+ export const isEmptyCases = [
2
+ { valueInput: '', valueOutput: true },
3
+ { valueInput: ' ', valueOutput: true },
4
+ { valueInput: null, valueOutput: true },
5
+ { valueInput: undefined, valueOutput: true },
6
+ { valueInput: '0', valueOutput: false },
7
+ { valueInput: 'ab', valueOutput: false },
8
+ ]
9
+
10
+
11
+ export const replaceAccentuatedCharsCases = [
12
+ { valueInput: 'ÁÀÂÃÄ', valueOutput: 'AAAAA' },
13
+ { valueInput: 'áàâãä', valueOutput: 'aaaaa' },
14
+ { valueInput: 'Ç', valueOutput: 'C' },
15
+ ]
16
+
17
+ export const replaceAccentuatedCharsKeepSymbolsCases = [
18
+ { valueInput: 'áéíóú', valueOutput: 'AEIOU' },
19
+ { valueInput: 'âêîôû', valueOutput: 'AEIOU' },
20
+ { valueInput: 'çñ', valueOutput: 'CN' },
21
+ { valueInput: 'ãõ', valueOutput: 'AO' },
22
+ { valueInput: 'hello', valueOutput: 'HELLO' },
23
+ { valueInput: 'WORLD', valueOutput: 'WORLD' },
24
+ { valueInput: '12345', valueOutput: '12345' },
25
+ { valueInput: '!@#$%^&*()', valueOutput: '!@#$%^&*()' },
26
+ { valueInput: 'Olá, mundo!', valueOutput: 'OLA, MUNDO!' },
27
+ { valueInput: 'Café com leite!', valueOutput: 'CAFE COM LEITE!' },
28
+ { valueInput: '123 çñ áéíóú', valueOutput: '123 CN AEIOU' },
29
+ { valueInput: '', valueOutput: '' },
30
+ { valueInput: 'àèìòù', valueOutput: 'AEIOU' },
31
+ { valueInput: 'ÀÈÌÒÙ', valueOutput: 'AEIOU' },
32
+ { valueInput: 'ÁÉÍÓÚÇÑãõâêîôû', valueOutput: 'AEIOUCNAOAEIOU' },
33
+ ];
34
+
35
+ export const replaceBlankCharactersCases = [
36
+ { valueInput: 'Hello World', valueOutput: 'HelloWorld' },
37
+ { valueInput: 'Test 123', valueOutput: 'Test123' },
38
+ { valueInput: 'Replace spaces', valueOutput: 'Replacespaces' },
39
+ { valueInput: 'NoSpacesHere', valueOutput: 'NoSpacesHere' },
40
+ { valueInput: 'Multiple spaces here', valueOutput: 'Multiplespaceshere' },
41
+ { valueInput: ' Leading and trailing spaces ', valueOutput: 'Leadingandtrailingspaces' },
42
+ { valueInput: '', valueOutput: '' },
43
+ { valueInput: 'SingleSpace', valueOutput: 'SingleSpace' },
44
+ ];
45
+
46
+ export const replaceToSpaceCases = [
47
+ { valueInput: 'Hello World', replaceList: ['World'], valueOutput: 'Hello ' },
48
+ { valueInput: 'Test 123', replaceList: ['123'], valueOutput: 'Test ' },
49
+ { valueInput: 'Replace the word', replaceList: ['word'], valueOutput: 'Replace the ' },
50
+ { valueInput: 'No change here', replaceList: ['no'], valueOutput: 'No change here' },
51
+ { valueInput: 'Multiple words to replace', replaceList: ['Multiple', 'replace'], valueOutput: ' words to ' },
52
+ { valueInput: ' Leading and trailing spaces ', replaceList: ['Leading', 'spaces'], valueOutput: ' and trailing ' },
53
+ { valueInput: '', replaceList: ['word'], valueOutput: '' },
54
+ { valueInput: 'Single word replacement', replaceList: ['word'], valueOutput: 'Single replacement' },
55
+ { valueInput: 'Only word here', replaceList: ['Only', 'here'], valueOutput: ' word ' },
56
+ { valueInput: 'Replace multiple occurrences', replaceList: ['multiple'], valueOutput: 'Replace occurrences' },
57
+ ];
58
+
59
+ export const replaceAllCases = [
60
+ { valueInput: 'Hello World', strFrom: 'World', strTo: 'Universe', valueOutput: 'Hello Universe' },
61
+ { valueInput: 'Test 123 123', strFrom: '123', strTo: '456', valueOutput: 'Test 456 456' },
62
+ { valueInput: 'Replace all spaces', strFrom: ' ', strTo: '_', valueOutput: 'Replace_all_spaces' },
63
+ { valueInput: 'No changes here', strFrom: 'word', strTo: 'term', valueOutput: 'No changes here' },
64
+ { valueInput: 'Multiple occurrences of term term term', strFrom: 'term', strTo: 'word', valueOutput: 'Multiple occurrences of word word word' },
65
+ { valueInput: 'Case Sensitive Test', strFrom: 'test', strTo: 'exam', valueOutput: 'Case Sensitive Test' },
66
+ { valueInput: 'Multiple words to replace', strFrom: ' ', strTo: '-', valueOutput: 'Multiple-words-to-replace' },
67
+ { valueInput: '', strFrom: 'word', strTo: 'term', valueOutput: '' },
68
+ { valueInput: 'aaaa bbbb aaaa', strFrom: 'aaaa', strTo: 'cccc', valueOutput: 'cccc bbbb cccc' },
69
+ { valueInput: 'Look at this example: example example', strFrom: 'example', strTo: 'demo', valueOutput: 'Look at this demo: demo demo' },
70
+ ];
71
+
72
+ export const removeSpecialCharactersCases = [
73
+ { valueInput: 'Hello!@#$ World', valueOutput: 'Hello World' },
74
+ { valueInput: 'Test 123 #$%', valueOutput: 'Test 123 ' },
75
+ { valueInput: 'Remove *&%$# special characters!', valueOutput: 'Remove special characters' },
76
+ { valueInput: 'NoSpecialCharsHere', valueOutput: 'NoSpecialCharsHere' },
77
+ { valueInput: '!!!Start and End!!!', valueOutput: 'Start and End' },
78
+ { valueInput: '12345', valueOutput: '12345' },
79
+ { valueInput: 'Clean this string @&*#$', valueOutput: 'Clean this string ' },
80
+ { valueInput: '', valueOutput: '' },
81
+ { valueInput: 'We @like $ to @#test!!', valueOutput: 'We like to test' },
82
+ { valueInput: 'Some $pec!@l #chars %%%%%&*(', valueOutput: 'Some pecl chars ' },
83
+ ];
84
+
85
+ export const isStringCases = [
86
+ { valueInput: 'Hello, World!', valueOutput: true },
87
+ { valueInput: '', valueOutput: true },
88
+ { valueInput: new String('Test String'), valueOutput: true },
89
+ { valueInput: 12345, valueOutput: false },
90
+ { valueInput: null, valueOutput: false },
91
+ { valueInput: undefined, valueOutput: false },
92
+ { valueInput: { key: 'value' }, valueOutput: false },
93
+ { valueInput: ['array'], valueOutput: false },
94
+ { valueInput: true, valueOutput: false },
95
+ { valueInput: Symbol('test'), valueOutput: false },
96
+ { valueInput: function () {}, valueOutput: false },
97
+ { valueInput: NaN, valueOutput: false },
98
+ ];
99
+
100
+ export const decodeHtmlEntitiesCases = [
101
+ { valueInput: 'Hello & World', valueOutput: 'Hello & World' },
102
+ { valueInput: 'Apostrophe: ' or '', valueOutput: 'Apostrophe: \' or \'' },
103
+ { valueInput: 'Slash: / or /', valueOutput: 'Slash: / or /' },
104
+ { valueInput: 'Less than: &lt; Greater than: &gt;', valueOutput: 'Less than: < Greater than: >' },
105
+ { valueInput: 'Non-breaking space: &nbsp;', valueOutput: 'Non-breaking space: ' },
106
+ { valueInput: 'Quote: &quot;', valueOutput: 'Quote: "' },
107
+ { valueInput: 'No entities here', valueOutput: 'No entities here' },
108
+ { valueInput: '', valueOutput: '' },
109
+ { valueInput: 'Multiple entities: &amp;&lt;&gt;&quot;', valueOutput: 'Multiple entities: &<>"' },
110
+ { valueInput: null, valueOutput: null },
111
+ { valueInput: undefined, valueOutput: undefined },
112
+ ];
113
+
114
+ export const hashCodeCases = [
115
+ { valueInput: 'hello', valueOutput: '99162322' }, // Valor conhecido do hash
116
+ { valueInput: 'world', valueOutput: '113318802' },
117
+ { valueInput: '12345', valueOutput: '46792755' },
118
+ { valueInput: '', valueOutput: '0' }, // Caso de string vazia
119
+ { valueInput: 'a', valueOutput: '97' }, // Código ASCII de 'a'
120
+ { valueInput: 'abc', valueOutput: '96354' }, // Valor hash de 'abc'
121
+ { valueInput: 'Hello, World!', valueOutput: '1498789909' }, // Teste com caracteres especiais
122
+ { valueInput: '😊', valueOutput: '1772909' }, // Emoji (unicode)
123
+ { valueInput: 'Same input, same hash', valueOutput: '-895136796' }, // Consistência do hash
124
+ { valueInput: 'Same input, same hash', valueOutput: '-895136796' }, // Repetição do caso anterior
125
+ ];
126
+
127
+ export const getBooleanValueCases = [
128
+ { valueInput: 'true', defaultValue: false, valueOutput: true },
129
+ { valueInput: 'false', defaultValue: true, valueOutput: false },
130
+ { valueInput: 'S', defaultValue: false, valueOutput: true }, // "S" considerado como true
131
+ { valueInput: 'N', defaultValue: true, valueOutput: false }, // "N" considerado como false
132
+ { valueInput: true, defaultValue: false, valueOutput: true }, // Valor booleano verdadeiro
133
+ { valueInput: false, defaultValue: true, valueOutput: false }, // Valor booleano falso
134
+ { valueInput: 'yes', defaultValue: false, valueOutput: false }, // String não reconhecida
135
+ { valueInput: 'no', defaultValue: true, valueOutput: true }, // String não reconhecida
136
+ { valueInput: '', defaultValue: true, valueOutput: true }, // String vazia
137
+ { valueInput: undefined, defaultValue: false, valueOutput: false }, // Valor indefinido
138
+ { valueInput: null, defaultValue: true, valueOutput: true }, // Valor nulo
139
+ ];
140
+
141
+ export const padStartCases = [
142
+ { valueInput: { str: '123', len: 6, pad: '0' }, valueOutput: '000123' }, // Preenchimento com '0'
143
+ { valueInput: { str: 'test', len: 8, pad: ' ' }, valueOutput: ' test' }, // Preenchimento com espaços
144
+ { valueInput: { str: '', len: 5, pad: '*' }, valueOutput: '*****' }, // String vazia
145
+ { valueInput: { str: 'short', len: 3, pad: '-' }, valueOutput: 'short' }, // Nenhum preenchimento necessário
146
+ { valueInput: { str: undefined, len: 4, pad: '#' }, valueOutput: '####' }, // `undefined` tratado como string vazia
147
+ { valueInput: { str: null, len: 4, pad: '0' }, valueOutput: '0000' }, // `null` tratado como string vazia
148
+ { valueInput: { str: 'pad', len: 10, pad: '-' }, valueOutput: '-------pad' }, // Preenchimento com um caractere repetido
149
+ { valueInput: { str: '42', len: 5, pad: 'abc' }, valueOutput: 'abc42' }, // Preenchimento com sequência que excede o tamanho necessário
150
+ { valueInput: { str: 'exact', len: 5, pad: '*' }, valueOutput: 'exact' }, // Comprimento já igual ao esperado
151
+ { valueInput: { str: '', len: 0, pad: '-' }, valueOutput: '' }, // Comprimento zero, sem preenchimento
152
+ ];
153
+
154
+ export const padEndCases = [
155
+ { valueInput: { str: '123', len: 6, pad: '0' }, valueOutput: '123000' }, // Preenchimento com '0'
156
+ { valueInput: { str: 'test', len: 8, pad: ' ' }, valueOutput: 'test ' }, // Preenchimento com espaços
157
+ { valueInput: { str: '', len: 5, pad: '*' }, valueOutput: '*****' }, // String vazia
158
+ { valueInput: { str: 'short', len: 3, pad: '-' }, valueOutput: 'short' }, // Nenhum preenchimento necessário
159
+ { valueInput: { str: undefined, len: 4, pad: '#' }, valueOutput: '####' }, // `undefined` tratado como string vazia
160
+ { valueInput: { str: null, len: 4, pad: '0' }, valueOutput: '0000' }, // `null` tratado como string vazia
161
+ { valueInput: { str: 'pad', len: 10, pad: '-' }, valueOutput: 'pad-------' }, // Preenchimento com um caractere repetido
162
+ { valueInput: { str: '42', len: 5, pad: 'abc' }, valueOutput: '42abc' }, // Preenchimento com sequência que excede o tamanho necessário
163
+ { valueInput: { str: 'exact', len: 5, pad: '*' }, valueOutput: 'exact' }, // Comprimento já igual ao esperado
164
+ { valueInput: { str: '', len: 0, pad: '-' }, valueOutput: '' }, // Comprimento zero, sem preenchimento
165
+ ];
166
+
167
+ export const compareCases = [
168
+ { valueInput: { a: undefined, b: undefined }, valueOutput: 0 }, // Ambos undefined
169
+ { valueInput: { a: undefined, b: null }, valueOutput: 1 }, // a undefined, b null
170
+ { valueInput: { a: null, b: undefined }, valueOutput: -1 }, // a null, b undefined
171
+ { valueInput: { a: null, b: null }, valueOutput: 0 }, // Ambos null
172
+ { valueInput: { a: 'apple', b: undefined }, valueOutput: -1 }, // b undefined
173
+ { valueInput: { a: undefined, b: 'banana' }, valueOutput: 1 }, // a undefined
174
+ { valueInput: { a: 'apple', b: null }, valueOutput: -1 }, // b null
175
+ { valueInput: { a: null, b: 'banana' }, valueOutput: 1 }, // a null
176
+ { valueInput: { a: 'apple', b: 'banana' }, valueOutput: -1 }, // Comparação lexical
177
+ { valueInput: { a: 'banana', b: 'apple' }, valueOutput: 1 }, // Comparação lexical invertida
178
+ { valueInput: { a: 'apple', b: 'apple' }, valueOutput: 0 }, // Strings iguais
179
+ { valueInput: { a: 'Apple', b: 'apple' }, valueOutput: 1 }, // Case-sensitive (lexical)
180
+ { valueInput: { a: '123', b: '456' }, valueOutput: -1 }, // Strings numéricas
181
+ { valueInput: { a: '', b: 'non-empty' }, valueOutput: -1 }, // String vazia comparada com não vazia
182
+ { valueInput: { a: 'non-empty', b: '' }, valueOutput: 1 }, // Não vazia comparada com vazia
183
+ ];
184
+
185
+ export const toCamelCaseCases = [
186
+ { valueInput: 'hello_world', valueOutput: 'helloWorld' }, // Underscore
187
+ { valueInput: 'hello-world', valueOutput: 'helloWorld' }, // Hífen
188
+ { valueInput: 'hello world', valueOutput: 'helloWorld' }, // Espaço
189
+ { valueInput: 'HelloWorld', valueOutput: 'helloworld' }, // Primeiro caractere maiúsculo
190
+ { valueInput: 'helloWorld', valueOutput: 'helloWorld' }, // Já em camelCase
191
+ { valueInput: 'hello.world', valueOutput: 'hello.world' }, // Contém ponto (não altera)
192
+ { valueInput: 'HELLO_WORLD', valueOutput: 'helloWorld' }, // Uppercase e underscore
193
+ { valueInput: 'multiple words-separated_hyphen', valueOutput: 'multipleWordsSeparatedHyphen' }, // Vários separadores
194
+ { valueInput: 'CamelCaseAlready', valueOutput: 'camelcasealready' }, // Já em camelCase com primeiro caractere maiúsculo
195
+ { valueInput: '', valueOutput: '' }, // String vazia
196
+ { valueInput: null, valueOutput: '' }, // Valor nulo
197
+ { valueInput: undefined, valueOutput: '' }, // Valor indefinido
198
+ { valueInput: 'simple', valueOutput: 'simple' }, // Palavra única em minúsculo
199
+ { valueInput: 'PascalCase', valueOutput: 'pascalcase' }, // PascalCase para camelCase
200
+ ];
201
+
202
+ export const toPascalCaseCases = [
203
+ { valueInput: 'hello_world', valueOutput: 'Helloworld' }, // Underscore
204
+ { valueInput: 'hello-world', valueOutput: 'Helloworld' }, // Hífen
205
+ { valueInput: 'hello world', valueOutput: 'HelloWorld' }, // Espaço
206
+ { valueInput: 'HelloWorld', valueOutput: 'Helloworld' }, // Já em PascalCase
207
+ { valueInput: 'helloWorld', valueOutput: 'Helloworld' }, // camelCase para PascalCase
208
+ { valueInput: 'hello.world', valueOutput: 'Hello.world' }, // Contém ponto (não altera)
209
+ { valueInput: 'HELLO_WORLD', valueOutput: 'Helloworld' }, // Uppercase e underscore
210
+ { valueInput: 'multiple words-separated_hyphen', valueOutput: 'MultipleWordsseparatedhyphen' }, // Vários separadores
211
+ { valueInput: 'camelCaseAlready', valueOutput: 'Camelcasealready' }, // camelCase para PascalCase
212
+ { valueInput: '', valueOutput: '' }, // String vazia
213
+ { valueInput: null, valueOutput: '' }, // Valor nulo
214
+ { valueInput: undefined, valueOutput: '' }, // Valor indefinido
215
+ { valueInput: 'simple', valueOutput: 'Simple' }, // Palavra única em minúsculo
216
+ { valueInput: 'PascalCase', valueOutput: 'Pascalcase' }, // Já em PascalCase
217
+ ];
218
+
219
+ export const toSnakeCaseCases = [
220
+ { valueInput: 'helloWorld', valueOutput: 'helloworld' }, // camelCase para snake_case
221
+ { valueInput: 'HelloWorld', valueOutput: 'helloworld' }, // PascalCase para snake_case
222
+ { valueInput: 'hello-world', valueOutput: 'hello_world' }, // Hífen para underscore
223
+ { valueInput: 'hello world', valueOutput: 'hello_world' }, // Espaço para underscore
224
+ { valueInput: 'hello_world', valueOutput: 'hello_world' }, // Já em snake_case (sem alterações)
225
+ { valueInput: 'HELLO_WORLD', valueOutput: 'hello_world' }, // Tudo maiúsculo para minúsculo
226
+ { valueInput: 'multipleWordsSeparated-Hyphen', valueOutput: 'multiplewordsseparated_hyphen' }, // Mistura de espaços e hífen
227
+ { valueInput: 'CamelCaseAlready', valueOutput: 'camelcasealready' }, // PascalCase para snake_case
228
+ { valueInput: 'simple', valueOutput: 'simple' }, // Palavra única em minúsculo (sem alterações)
229
+ { valueInput: 'PascalCase', valueOutput: 'pascalcase' }, // PascalCase para snake_case
230
+ { valueInput: '', valueOutput: '' }, // String vazia
231
+ { valueInput: null, valueOutput: '' }, // Valor nulo
232
+ { valueInput: undefined, valueOutput: '' }, // Valor indefinido
233
+ { valueInput: 'hello.world', valueOutput: 'hello.world' }, // Contém ponto (não altera)
234
+ ];
235
+
236
+ export const toKebabCaseCases = [
237
+ { valueInput: 'helloWorld', valueOutput: 'hello-world' }, // camelCase para kebab-case
238
+ { valueInput: 'HelloWorld', valueOutput: 'hello-world' }, // PascalCase para kebab-case
239
+ { valueInput: 'hello_world', valueOutput: 'hello-world' }, // Underscore para hífen
240
+ { valueInput: 'hello world', valueOutput: 'hello-world' }, // Espaço para hífen
241
+ { valueInput: 'hello-world', valueOutput: 'hello-world' }, // Já em kebab-case (sem alterações)
242
+ { valueInput: 'HELLO_WORLD', valueOutput: 'hello-world' }, // Tudo maiúsculo para minúsculo com underscore
243
+ { valueInput: 'multipleWordsSeparated_Hyphen', valueOutput: 'multiple-words-separated-hyphen' }, // Mistura de espaços e underscore
244
+ { valueInput: 'CamelCaseAlready', valueOutput: 'camel-case-already' }, // PascalCase para kebab-case
245
+ { valueInput: 'simple', valueOutput: 'simple' }, // Palavra única em minúsculo (sem alterações)
246
+ { valueInput: 'PascalCase', valueOutput: 'pascal-case' }, // PascalCase para kebab-case
247
+ { valueInput: '', valueOutput: '' }, // String vazia
248
+ { valueInput: null, valueOutput: '' }, // Valor nulo
249
+ { valueInput: undefined, valueOutput: '' }, // Valor indefinido
250
+ { valueInput: 'hello.world', valueOutput: 'hello.world' }, // Contém ponto (não altera)
251
+ ];
252
+
253
+ export const formatBytesCases = [
254
+ { valueInput: 0, valueOutput: '0B' }, // Zero bytes
255
+ { valueInput: 1, valueOutput: '1B' }, // 1 byte
256
+ { valueInput: 512, valueOutput: '512B' }, // Menos que 1KB
257
+ { valueInput: 1023, valueOutput: '1023B' }, // Ainda em bytes
258
+ { valueInput: 1024, valueOutput: '1KB' }, // Exatamente 1KB
259
+ { valueInput: 1536, valueOutput: '1.5KB' }, // 1.5KB
260
+ { valueInput: 1048576, valueOutput: '1MB' }, // Exatamente 1MB
261
+ { valueInput: 1572864, valueOutput: '1.5MB' }, // 1.5MB
262
+ { valueInput: 1073741824, valueOutput: '1GB' }, // Exatamente 1GB
263
+ { valueInput: 1610612736, valueOutput: '1.5GB' }, // 1.5GB
264
+ { valueInput: 1099511627776, valueOutput: '1099511627776B' }, // Acima de GB (mantém em B)
265
+ { valueInput: -1024, valueOutput: '-1024B' }, // Valor negativo (mantém em B)
266
+ { valueInput: NaN, valueOutput: 'NaNundefined' }, // Valor inválido
267
+ { valueInput: null, valueOutput: 'undefinedB' }, // Valor nulo tratado como NaN
268
+ { valueInput: undefined, valueOutput: 'NaNundefined' }, // Valor indefinido tratado como NaN
269
+ ];
270
+
271
+ export const prettyPrecisionCases = [
272
+ { valueInput: '100.00', valueOutput: '100' }, // Remove todos os zeros desnecessários
273
+ { valueInput: '123.4500', valueOutput: '123.45' }, // Remove zeros à direita após a vírgula
274
+ { valueInput: '0.900', valueOutput: '0.9' }, // Remove zeros à direita após a vírgula
275
+ { valueInput: '5.10', valueOutput: '5.1' }, // Remove último zero, mantém decimal
276
+ { valueInput: '42.0', valueOutput: '42' }, // Remove ".0" quando não há outra decimal relevante
277
+ { valueInput: '3.14159000', valueOutput: '3.14159' }, // Mantém parte decimal relevante
278
+ { valueInput: '0.000', valueOutput: '0' }, // Apenas zeros devem resultar em "0"
279
+ { valueInput: '250', valueOutput: '250' }, // Número inteiro não muda
280
+ { valueInput: '999.999', valueOutput: '999.999' }, // Nenhum zero extra, mantém como está
281
+ { valueInput: '100.', valueOutput: '100' }, // Remove ponto final se não houver decimal
282
+ { valueInput: '.500', valueOutput: '.5' }, // Adiciona zero antes do ponto se necessário
283
+ { valueInput: '0.', valueOutput: '0' }, // Remove ponto final solitário
284
+ { valueInput: '123.456789000', valueOutput: '123.456789' }, // Mantém casas decimais relevantes
285
+ { valueInput: '0.0', valueOutput: '0' }, // Remove ".0" de zero
286
+ { valueInput: '', valueOutput: '' }, // String vazia permanece vazia
287
+ ];
288
+
289
+ export const isCaseableCases = [
290
+ { valueInput: 'hello', valueOutput: true }, // Apenas minúsculas
291
+ { valueInput: 'HELLO', valueOutput: true }, // Apenas maiúsculas
292
+ { valueInput: 'Hello', valueOutput: true }, // Mistura de maiúsculas e minúsculas
293
+ { valueInput: 'hElLo', valueOutput: true }, // Alternância de maiúsculas e minúsculas
294
+ { valueInput: '12345', valueOutput: false }, // Apenas números
295
+ { valueInput: '123ABC', valueOutput: true }, // Números e letras maiúsculas
296
+ { valueInput: '123abc', valueOutput: true }, // Números e letras minúsculas
297
+ { valueInput: '123aBc', valueOutput: true }, // Mistura de números e letras caseáveis
298
+ { valueInput: '!@#$%^&*()', valueOutput: false }, // Apenas caracteres especiais
299
+ { valueInput: 'hello_world', valueOutput: true }, // Contém underscore mas tem letras
300
+ { valueInput: 'HELLO-WORLD', valueOutput: true }, // Contém hífen mas tem letras
301
+ { valueInput: '', valueOutput: false }, // String vazia
302
+ { valueInput: ' ', valueOutput: false }, // Apenas espaço
303
+ { valueInput: null, valueOutput: false }, // Valor nulo
304
+ { valueInput: undefined, valueOutput: false }, // Valor indefinido
305
+ ];
306
+
307
+ export const isLowerCaseCases = [
308
+ { valueInput: 'hello', valueOutput: true }, // Apenas minúsculas
309
+ { valueInput: 'HELLO', valueOutput: false }, // Apenas maiúsculas
310
+ { valueInput: 'Hello', valueOutput: true }, // Primeira maiúscula, restante minúscula TODO: REAVALIAR
311
+ { valueInput: 'hElLo', valueOutput: true }, // Alternância de maiúsculas e minúsculas TODO: REAVALIAR
312
+ { valueInput: 'hello world', valueOutput: true }, // Minúsculas com espaço
313
+ { valueInput: 'hello_world', valueOutput: true }, // Minúsculas com underscore
314
+ { valueInput: 'hello-world', valueOutput: true }, // Minúsculas com hífen
315
+ { valueInput: '12345', valueOutput: false }, // Apenas números
316
+ { valueInput: '123abc', valueOutput: true }, // Números e letras minúsculas
317
+ { valueInput: '123ABC', valueOutput: false }, // Números e letras maiúsculas
318
+ { valueInput: '!@#$%^&*()', valueOutput: false }, // Apenas caracteres especiais
319
+ { valueInput: '', valueOutput: false }, // String vazia
320
+ { valueInput: ' ', valueOutput: false }, // Apenas espaço
321
+ { valueInput: null, valueOutput: false }, // Valor nulo
322
+ { valueInput: undefined, valueOutput: false }, // Valor indefinido
323
+ ];
324
+
325
+ export const getOppositeCaseCases = [
326
+ { valueInput: 'hello', valueOutput: 'HELLO' }, // Minúsculas para maiúsculas
327
+ { valueInput: 'HELLO', valueOutput: 'hello' }, // Maiúsculas para minúsculas
328
+ { valueInput: 'Hello', valueOutput: 'HELLO' }, // Primeira maiúscula, restante minúscula → tudo minúsculo //TODO: ANALISAR
329
+ { valueInput: 'hElLo', valueOutput: 'HELLO' }, // Alternância de maiúsculas e minúsculas → tudo minúsculo //TODO: ANALISAR
330
+ { valueInput: 'hello world', valueOutput: 'HELLO WORLD' }, // Minúsculas com espaço → Maiúsculas
331
+ { valueInput: 'HELLO WORLD', valueOutput: 'hello world' }, // Maiúsculas com espaço → Minúsculas
332
+ { valueInput: 'hello_world', valueOutput: 'HELLO_WORLD' }, // Minúsculas com underscore → Maiúsculas
333
+ { valueInput: 'HELLO_WORLD', valueOutput: 'hello_world' }, // Maiúsculas com underscore → Minúsculas
334
+ { valueInput: 'hello-world', valueOutput: 'HELLO-WORLD' }, // Minúsculas com hífen → Maiúsculas
335
+ { valueInput: 'HELLO-WORLD', valueOutput: 'hello-world' }, // Maiúsculas com hífen → Minúsculas
336
+ { valueInput: '12345', valueOutput: '12345' }, // Apenas números (sem alteração)
337
+ { valueInput: '123abc', valueOutput: '123ABC' }, // Números e letras minúsculas → Letras maiúsculas
338
+ { valueInput: '123ABC', valueOutput: '123abc' }, // Números e letras maiúsculas → Letras minúsculas
339
+ { valueInput: '!@#$%^&*()', valueOutput: '!@#$%^&*()' }, // Apenas caracteres especiais (sem alteração)
340
+ { valueInput: '', valueOutput: '' }, // String vazia (sem alteração)
341
+ { valueInput: ' ', valueOutput: ' ' }, // Apenas espaço (sem alteração)
342
+ { valueInput: null, valueOutput: '' }, // Valor nulo tratado como string vazia
343
+ { valueInput: undefined, valueOutput: '' }, // Valor indefinido tratado como string vazia
344
+ ];
345
+
346
+ export const getSpecialCharactersCases = [
347
+ { valueInput: 'hello', valueOutput: [] }, // Nenhum caractere especial
348
+ { valueInput: 'hello@world.com', valueOutput: ['@', '.'] }, // E-mail: captura '@' e '.'
349
+ { valueInput: 'price: $100.00', valueOutput: [':', '$', '.'] }, // Preço: captura ':', '$' e '.'
350
+ { valueInput: '50% discount!', valueOutput: ['%', '!'] }, // Captura '%' e '!'
351
+ { valueInput: 'C:\\Users\\Admin', valueOutput: [':', '\\', '\\'] }, // Caminho do Windows: captura '\\'
352
+ { valueInput: 'https://example.com', valueOutput: [':', '/', '/', '.'] }, // URL: captura ':', '/', '/', '.'
353
+ { valueInput: 'filename.txt', valueOutput: ['.'] }, // Extensão de arquivo: captura '.'
354
+ { valueInput: 'sum = a + b - c * d / e', valueOutput: ['=', '+', '-', '*', '/'] }, // Operadores matemáticos
355
+ { valueInput: '#hashtag @user!', valueOutput: ['#', '@', '!'] }, // Hashtags e menções
356
+ { valueInput: '(parentheses) & [brackets] {curly}', valueOutput: ['(', ')', '&', '[' ] }, // Captura parênteses e colchetes
357
+ { valueInput: 'one_two-three', valueOutput: ['_', '-'] }, // Captura underscore e hífen
358
+ { valueInput: 'email+alias@gmail.com', valueOutput: ['+', '@', '.'] }, // Captura '+' usado em e-mails
359
+ { valueInput: 'a = "text" or \'char\'', valueOutput: ['=', '"', '"', "'", "'"] }, // Aspas duplas e simples
360
+ { valueInput: '', valueOutput: [] }, // String vazia → Nenhum caractere especial
361
+ { valueInput: ' ', valueOutput: [] }, // Apenas espaços → Nenhum caractere especial
362
+ { valueInput: null, valueOutput: [] }, // Valor nulo tratado como string vazia
363
+ { valueInput: undefined, valueOutput: [] }, // Valor indefinido tratado como string vazia
364
+ ];
365
+
366
+ export const getArgumentNumberCases = [
367
+ { valueInput: '42', valueOutput: 42 }, // Número inteiro válido
368
+ { valueInput: '3.14', valueOutput: 3.14 }, // Número decimal válido
369
+ { valueInput: '-100', valueOutput: -100 }, // Número negativo válido
370
+ { valueInput: '0', valueOutput: 0 }, // Zero
371
+ { valueInput: '', valueOutput: NaN }, // String vazia → NaN
372
+ { valueInput: 'abc', valueOutput: NaN }, // String não numérica → NaN
373
+ { valueInput: '123abc', valueOutput: NaN }, // Mistura de número e letras → NaN
374
+ { valueInput: ' 50 ', valueOutput: 50 }, // Número com espaços → Convertido corretamente
375
+ { valueInput: '1e3', valueOutput: 1000 }, // Notação científica → 1000
376
+ { valueInput: 'Infinity', valueOutput: Infinity }, // Infinity string → Infinity
377
+ { valueInput: '-Infinity', valueOutput: -Infinity }, // -Infinity string → -Infinity
378
+ { valueInput: null, valueOutput: NaN }, // Valor nulo → NaN
379
+ { valueInput: undefined, valueOutput: NaN }, // Valor indefinido → NaN
380
+ ];
381
+
382
+ export const highlightValueCases = [
383
+ {
384
+ valueInput: { argument: 'hello', matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
385
+ valueOutput: "<span class='card-item__highlight'>hello</span> world"
386
+ }, // Palavra encontrada e destacada
387
+ {
388
+ valueInput: { argument: 'world', matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
389
+ valueOutput: "hello <span class='card-item__highlight'>world</span>"
390
+ }, // Última palavra destacada
391
+ {
392
+ valueInput: { argument: 'lo', matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
393
+ valueOutput: "hel<span class='card-item__highlight'>lo</span> world"
394
+ }, // Destacando parte de uma palavra
395
+ {
396
+ valueInput: { argument: 'Hello', matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
397
+ valueOutput: "<span class='card-item__highlight'>hello</span> world"
398
+ }, // Case insensitive
399
+ {
400
+ valueInput: { argument: 'hello', matchFields: ['field1'], value: 'hello hello', fieldMD: { fieldName: 'field1' }, forceMatch: false },
401
+ valueOutput: "<span class='card-item__highlight'>hello</span> hello"
402
+ }, // Destacando palavras repetidas //TODO: analisar, pois não sabe lidar com esse cenário
403
+ {
404
+ valueInput: { argument: '123', matchFields: ['field1'], value: 'abc 123 def', fieldMD: { fieldName: 'field1' }, forceMatch: false },
405
+ valueOutput: "abc <span class='card-item__highlight'>123</span> def"
406
+ }, // Destacando número
407
+ {
408
+ valueInput: { argument: 'abc', matchFields: ['field2'], value: 'abc 123 def', fieldMD: { fieldName: 'field1' }, forceMatch: false },
409
+ valueOutput: "<span class='card-item__highlight'>abc</span> 123 def"
410
+ }, // Campo não corresponde, não há destaque
411
+ {
412
+ valueInput: { argument: 'abc', matchFields: ['field1'], value: 'abc 123 def', fieldMD: { fieldName: 'field1' }, forceMatch: true },
413
+ valueOutput: "<span class='card-item__highlight'>abc</span> 123 def"
414
+ }, // `forceMatch` ativado, destacando mesmo sem correspondência de campo
415
+ {
416
+ valueInput: { argument: 'abc', matchFields: ['field1'], value: 'ABC 123 def', fieldMD: { fieldName: 'field1' }, forceMatch: false },
417
+ valueOutput: "<span class='card-item__highlight'>ABC</span> 123 def"
418
+ }, // Case insensitive destaque
419
+ {
420
+ valueInput: { argument: '!', matchFields: ['field1'], value: 'hello!', fieldMD: { fieldName: 'field1' }, forceMatch: false },
421
+ valueOutput: "hello!"
422
+ }, // Caracteres especiais não são destacados
423
+ {
424
+ valueInput: { argument: '', matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
425
+ valueOutput: "hello world"
426
+ }, // Argumento vazio, sem destaque
427
+ {
428
+ valueInput: { argument: null, matchFields: ['field1'], value: 'hello world', fieldMD: { fieldName: 'field1' }, forceMatch: false },
429
+ valueOutput: "hello world"
430
+ }, // `null` como argumento, sem destaque
431
+ {
432
+ valueInput: { argument: 'hello', matchFields: ['field1'], value: '', fieldMD: { fieldName: 'field1' }, forceMatch: false },
433
+ valueOutput: ""
434
+ }, // Valor vazio, sem destaque
435
+ ];
@@ -0,0 +1,43 @@
1
+ export const validateTimeTestCases = [
2
+ { value: '2525', showSeconds: false, expected: false },
3
+ { value: '2525', showSeconds: true, expected: false },
4
+ { value: '232920', showSeconds: true, expected: true },
5
+ { value: '232920', showSeconds: false, expected: true },
6
+
7
+ { value: '1012', showSeconds: false, expected: true },
8
+ { value: '0012', showSeconds: false, expected: true },
9
+ { value: '2359', showSeconds: false, expected: true },
10
+
11
+ { value: '101200', showSeconds: true, expected: true },
12
+ { value: '000000', showSeconds: true, expected: true },
13
+ { value: '235959', showSeconds: true, expected: true },
14
+
15
+ { value: '2460', showSeconds: false, expected: false },
16
+ { value: '2500', showSeconds: false, expected: false },
17
+ { value: '9900', showSeconds: false, expected: false },
18
+
19
+ { value: '1260', showSeconds: false, expected: false },
20
+ { value: '1275', showSeconds: false, expected: false },
21
+
22
+ { value: '101260', showSeconds: true, expected: false },
23
+ { value: '101275', showSeconds: true, expected: false },
24
+
25
+ { value: '', showSeconds: false, expected: false },
26
+ { value: null as any, showSeconds: false, expected: false },
27
+ { value: undefined as any, showSeconds: false, expected: false },
28
+
29
+
30
+ { value: 'abcd', showSeconds: false, expected: false },
31
+ { value: '14e4', showSeconds: false, expected: false },
32
+ { value: '10:12', showSeconds: false, expected: true },
33
+
34
+ { value: '0000', showSeconds: false, expected: true },
35
+ { value: '2359', showSeconds: false, expected: true },
36
+ { value: '000000', showSeconds: true, expected: true },
37
+ { value: '235959', showSeconds: true, expected: true },
38
+
39
+ { value: '1', showSeconds: false, expected: false },
40
+ { value: '12', showSeconds: false, expected: false },
41
+ { value: '123', showSeconds: false, expected: true },
42
+ { value: '12345', showSeconds: true, expected: true },
43
+ ]