@jahia/cypress 7.4.0 → 8.1.0

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 (135) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +69 -2
  3. package/dist/index.js +6 -2
  4. package/dist/injections/bash-data.d.ts +1 -0
  5. package/dist/injections/bash-data.js +57 -0
  6. package/dist/injections/chars-data.d.ts +1 -0
  7. package/dist/injections/chars-data.js +25 -0
  8. package/dist/injections/htmlentities-data.d.ts +1 -0
  9. package/dist/injections/htmlentities-data.js +22 -0
  10. package/dist/injections/numbers-data.d.ts +1 -0
  11. package/dist/injections/numbers-data.js +66 -0
  12. package/dist/injections/sql-data.d.ts +1 -0
  13. package/dist/injections/sql-data.js +82 -0
  14. package/dist/injections/xss-data.d.ts +1 -0
  15. package/dist/injections/xss-data.js +740 -0
  16. package/dist/page-object/baseComponent.d.ts +1 -2
  17. package/dist/page-object/baseComponent.js +10 -6
  18. package/dist/page-object/basePage.js +1 -1
  19. package/dist/page-object/html/iframe.d.ts +0 -1
  20. package/dist/page-object/html/iframe.js +2 -2
  21. package/dist/page-object/html/index.js +6 -2
  22. package/dist/page-object/index.js +6 -2
  23. package/dist/page-object/material/index.js +6 -2
  24. package/dist/page-object/material/muiinput.d.ts +0 -1
  25. package/dist/page-object/material/muiinput.js +1 -1
  26. package/dist/page-object/material/muiradio.js +1 -1
  27. package/dist/page-object/moonstone/accordion.d.ts +0 -1
  28. package/dist/page-object/moonstone/accordion.js +2 -2
  29. package/dist/page-object/moonstone/button.js +1 -1
  30. package/dist/page-object/moonstone/collapsible.js +1 -1
  31. package/dist/page-object/moonstone/dropdown.js +2 -2
  32. package/dist/page-object/moonstone/index.js +6 -2
  33. package/dist/page-object/moonstone/menu.js +9 -9
  34. package/dist/page-object/moonstone/pagination.js +3 -3
  35. package/dist/page-object/moonstone/primaryNav.js +2 -2
  36. package/dist/page-object/moonstone/secondaryNav.js +1 -1
  37. package/dist/page-object/moonstone/table.d.ts +0 -1
  38. package/dist/page-object/moonstone/table.js +5 -5
  39. package/dist/page-object/utils.d.ts +0 -1
  40. package/dist/page-object/utils.js +11 -12
  41. package/dist/plugins/env.js +2 -2
  42. package/dist/plugins/index.js +6 -2
  43. package/dist/plugins/registerPlugins.js +2 -2
  44. package/dist/support/apollo/apollo.d.ts +5 -4
  45. package/dist/support/apollo/apollo.js +80 -18
  46. package/dist/support/apollo/apolloClient.d.ts +1 -2
  47. package/dist/support/apollo/apolloClient.js +7 -7
  48. package/dist/support/apollo/index.js +6 -2
  49. package/dist/support/apollo/links.d.ts +1 -1
  50. package/dist/support/apollo/links.js +5 -6
  51. package/dist/support/browserHelper.d.ts +10 -0
  52. package/dist/support/browserHelper.js +167 -0
  53. package/dist/support/commands.js +1 -1
  54. package/dist/support/fixture.d.ts +1 -1
  55. package/dist/support/fixture.js +11 -7
  56. package/dist/support/index.d.ts +3 -0
  57. package/dist/support/index.js +9 -2
  58. package/dist/support/jfaker.d.ts +60 -0
  59. package/dist/support/jfaker.js +241 -0
  60. package/dist/support/jsErrorsLogger.js +13 -9
  61. package/dist/support/login.d.ts +0 -1
  62. package/dist/support/login.js +2 -2
  63. package/dist/support/logout.d.ts +0 -1
  64. package/dist/support/logout.js +1 -1
  65. package/dist/support/modSince.d.ts +52 -0
  66. package/dist/support/modSince.js +180 -0
  67. package/dist/support/provisioning/executeGroovy.d.ts +1 -1
  68. package/dist/support/provisioning/executeGroovy.js +42 -3
  69. package/dist/support/provisioning/index.js +6 -2
  70. package/dist/support/provisioning/installConfig.d.ts +0 -1
  71. package/dist/support/provisioning/installConfig.js +3 -3
  72. package/dist/support/provisioning/installModule.d.ts +0 -1
  73. package/dist/support/provisioning/installModule.js +1 -1
  74. package/dist/support/provisioning/runProvisioningScript.d.ts +4 -5
  75. package/dist/support/provisioning/runProvisioningScript.js +86 -9
  76. package/dist/support/provisioning/uninstallModule.d.ts +0 -1
  77. package/dist/support/provisioning/uninstallModule.js +1 -1
  78. package/dist/support/registerSupport.js +35 -1
  79. package/dist/support/repeatUntil.d.ts +1 -2
  80. package/dist/support/repeatUntil.js +2 -2
  81. package/dist/support/testStep.js +2 -2
  82. package/dist/utils/ClusterHelper.js +1 -1
  83. package/dist/utils/ExportHelper.d.ts +2 -2
  84. package/dist/utils/ExportHelper.js +14 -10
  85. package/dist/utils/GraphQLHelper.js +21 -17
  86. package/dist/utils/JCRHelper.d.ts +1 -1
  87. package/dist/utils/JCRHelper.js +1 -1
  88. package/dist/utils/JahiaPlatformHelper.js +2 -2
  89. package/dist/utils/Logger.js +6 -6
  90. package/dist/utils/PublicationAndWorkflowHelper.js +3 -3
  91. package/dist/utils/SAMHelper.d.ts +1 -1
  92. package/dist/utils/SAMHelper.js +4 -4
  93. package/dist/utils/SiteHelper.js +2 -2
  94. package/dist/utils/UsersHelper.js +2 -2
  95. package/dist/utils/VanityUrlHelper.js +1 -1
  96. package/dist/utils/index.js +6 -2
  97. package/docs/browser-helper.md +158 -0
  98. package/docs/jfaker.md +450 -0
  99. package/package.json +13 -10
  100. package/src/injections/bash-data.ts +54 -0
  101. package/src/injections/chars-data.ts +22 -0
  102. package/src/injections/htmlentities-data.ts +19 -0
  103. package/src/injections/numbers-data.ts +63 -0
  104. package/src/injections/sql-data.ts +79 -0
  105. package/src/injections/xss-data.ts +737 -0
  106. package/src/page-object/baseComponent.ts +6 -6
  107. package/src/page-object/html/iframe.ts +3 -3
  108. package/src/page-object/material/muiinput.ts +1 -1
  109. package/src/page-object/material/muiradio.ts +1 -1
  110. package/src/page-object/moonstone/accordion.ts +1 -1
  111. package/src/page-object/moonstone/button.ts +1 -1
  112. package/src/page-object/moonstone/collapsible.ts +1 -1
  113. package/src/page-object/moonstone/dropdown.ts +1 -1
  114. package/src/page-object/moonstone/menu.ts +1 -1
  115. package/src/page-object/moonstone/pagination.ts +1 -1
  116. package/src/page-object/moonstone/primaryNav.ts +1 -1
  117. package/src/page-object/moonstone/secondaryNav.ts +1 -1
  118. package/src/page-object/moonstone/table.ts +2 -2
  119. package/src/support/apollo/apollo.ts +74 -11
  120. package/src/support/apollo/links.ts +1 -2
  121. package/src/support/browserHelper.ts +186 -0
  122. package/src/support/index.ts +3 -0
  123. package/src/support/jfaker.ts +245 -0
  124. package/src/support/modSince.ts +222 -0
  125. package/src/support/provisioning/executeGroovy.md +7 -1
  126. package/src/support/provisioning/executeGroovy.ts +46 -2
  127. package/src/support/provisioning/runProvisioningScript.ts +89 -12
  128. package/src/support/registerSupport.ts +29 -0
  129. package/tests/cypress/e2e/jfaker.spec.ts +411 -0
  130. package/tests/cypress/e2e/modSince.spec.ts +306 -0
  131. package/tests/cypress.config.ts +23 -0
  132. package/tests/package.json +41 -0
  133. package/tests/reporter-config.json +13 -0
  134. package/tests/yarn.lock +8578 -0
  135. package/tsconfig.json +3 -0
@@ -5,6 +5,8 @@ import {logout} from './logout';
5
5
  import {fixture} from './fixture';
6
6
  import {repeatUntil} from './repeatUntil';
7
7
  import {step} from './testStep';
8
+ import {jfaker} from './jfaker';
9
+ import {modSince} from './modSince';
8
10
 
9
11
  export const registerSupport = (): void => {
10
12
  Cypress.Commands.add('apolloClient', apolloClient);
@@ -24,4 +26,31 @@ export const registerSupport = (): void => {
24
26
  Cypress.Commands.overwrite('fixture', fixture);
25
27
 
26
28
  Cypress.Commands.add('step', step);
29
+
30
+ // Register it.since()/describe.since()
31
+ modSince.enable();
32
+
33
+ /**
34
+ * Override Cypress `type()` command to interpret special characters (e.g., {, }, etc.) either literally or as commands.
35
+ * The behavior is controlled by the `parseSpecialCharSequences` option, which can be set to `true`
36
+ * to enable command parsing or `false` to treat special characters as literal input.
37
+ *
38
+ * Since Cypress `clear()` command is an alias for `.type('{selectall}{del}')`,
39
+ * such case has to be handled to ensure that the special character sequences are properly interpreted when clearing the input.
40
+ * Also cover older Cypress versions which were using {backspace} was used instead of {del} .
41
+ */
42
+ Cypress.Commands.overwrite<'type', 'element'>(
43
+ 'type',
44
+ (originalFn, element, text: string, options: Partial<Cypress.TypeOptions> = {}) => {
45
+ // Check if this is Cypress `.clear() call
46
+ const isCypressClearSequence = ['{selectall}{del}', '{selectall}{backspace}'].includes(text.toString());
47
+
48
+ // Do not override if this is `.clear()` call or data type is `faker`
49
+ const parseSpecialCharSequences = isCypressClearSequence || jfaker.getDataType() === 'faker';
50
+
51
+ // Merge options with passed ones (if any)
52
+ const newOptions: Partial<Cypress.TypeOptions> = {parseSpecialCharSequences, ...options};
53
+ return originalFn(element, text, newOptions);
54
+ }
55
+ );
27
56
  };
@@ -0,0 +1,411 @@
1
+ /**
2
+ * Comprehensive tests for FakeData (jfaker) module
3
+ *
4
+ * This test suite covers:
5
+ * - Faker.js integration
6
+ * - Injection data generation
7
+ * - Global type management
8
+ * - Safe option
9
+ * - Edge cases and error handling
10
+ */
11
+
12
+ import {jfaker} from '../../../src';
13
+
14
+ describe('FakeData (jfaker) Module Tests', () => {
15
+ beforeEach(() => {
16
+ // Reset to default faker type before each test
17
+ jfaker.setDataType('faker');
18
+ });
19
+
20
+ describe('Utility Methods', () => {
21
+ it('should set and get data type', () => {
22
+ jfaker.setDataType('xss');
23
+ expect(jfaker.getDataType()).to.equal('xss');
24
+
25
+ jfaker.setDataType('faker');
26
+ expect(jfaker.getDataType()).to.equal('faker');
27
+ });
28
+
29
+ it('should escape strings correctly', () => {
30
+ const escaped = jfaker.escape('Hello "World"');
31
+ expect(escaped).to.equal('Hello \\"World\\"');
32
+
33
+ const escapedNewline = jfaker.escape('Line1\nLine2');
34
+ expect(escapedNewline).to.equal('Line1\\nLine2');
35
+
36
+ const escapedTab = jfaker.escape('Tab\there');
37
+ expect(escapedTab).to.equal('Tab\\there');
38
+ });
39
+ });
40
+
41
+ describe('Faker.js Integration', () => {
42
+ it('should generate faker data without arguments', () => {
43
+ const firstName = jfaker.person.firstName();
44
+ expect(firstName).to.be.a('string');
45
+ expect(firstName.length).to.be.greaterThan(0);
46
+ });
47
+
48
+ it('should generate different faker entities', () => {
49
+ jfaker.setDataType('htmlentities');
50
+ const firstName = jfaker.person.firstName();
51
+ const lastName = jfaker.person.lastName();
52
+ const email = jfaker.internet.email({safe: true});
53
+ const city = jfaker.location.city();
54
+
55
+ expect(firstName).to.be.a('string');
56
+ expect(lastName).to.be.a('string');
57
+ expect(email).to.include('@');
58
+ expect(city).to.be.a('string');
59
+ });
60
+
61
+ it('should generate faker data with options', () => {
62
+ const email = jfaker.internet.email({provider: 'example.com'});
63
+ expect(email).to.include('@example.com');
64
+ });
65
+
66
+ it('should generate faker data with length option', () => {
67
+ const alphaString = jfaker.string.alpha({length: 10});
68
+ expect(alphaString).to.have.lengthOf(10);
69
+ });
70
+
71
+ it('should generate faker data with multiple options', () => {
72
+ const word = jfaker.lorem.word({length: {min: 5, max: 10}});
73
+ expect(word).to.be.a('string');
74
+ expect(word.length).to.be.within(5, 10);
75
+ });
76
+
77
+ it('should throw error for invalid faker entity', () => {
78
+ expect(() => {
79
+ jfaker.invalid.nonexistent.method();
80
+ }).to.throw('[jFaker EXCEPTION] Invalid faker method');
81
+ });
82
+
83
+ it('should throw error for non-function faker property', () => {
84
+ expect(() => {
85
+ jfaker.person();
86
+ }).to.throw('[jFaker EXCEPTION]');
87
+ });
88
+ });
89
+
90
+ describe('Injection Data Generation', () => {
91
+ const injectionTypes = ['xss', 'sql', 'bash', 'chars', 'htmlentities', 'numbers'];
92
+
93
+ injectionTypes.forEach(type => {
94
+ it(`should generate ${type} injection data without length`, () => {
95
+ const data = jfaker[type]();
96
+ expect(data).to.be.a('string');
97
+ expect(data.length).to.be.greaterThan(0);
98
+ });
99
+
100
+ it(`should generate ${type} injection data with specific length`, () => {
101
+ const length = 50;
102
+ const data = jfaker[type]({length});
103
+ expect(data).to.be.a('string');
104
+ expect(data.length).to.equal(length);
105
+ });
106
+
107
+ it(`should generate all ${type} injection data with length -1`, () => {
108
+ const allData = jfaker[type]({length: -1});
109
+ expect(allData).to.be.a('string');
110
+ expect(allData.length).to.be.greaterThan(0);
111
+ });
112
+ });
113
+
114
+ it('should generate random length injection when length is 0', () => {
115
+ const data = jfaker.xss({length: 0});
116
+ expect(data).to.be.a('string');
117
+ // Should use default range (2-5 items)
118
+ expect(data.length).to.be.greaterThan(0);
119
+ });
120
+
121
+ it('should generate random length injection when length is undefined', () => {
122
+ const data = jfaker.sql();
123
+ expect(data).to.be.a('string');
124
+ expect(data.length).to.be.greaterThan(0);
125
+ });
126
+ });
127
+
128
+ describe('Global Type Settings', () => {
129
+ it('should use faker by default', () => {
130
+ const name = jfaker.person.firstName();
131
+ expect(name).to.be.a('string');
132
+ expect(name.length).to.be.greaterThan(0);
133
+ expect(name).to.not.include('<script>');
134
+ });
135
+
136
+ it('should switch to injection type when global type is set', () => {
137
+ jfaker.setDataType('xss');
138
+ const data = jfaker.person.firstName();
139
+ expect(data).to.be.a('string');
140
+ expect(data.length).to.be.greaterThan(0);
141
+ });
142
+
143
+ it('should persist data type across multiple calls', () => {
144
+ jfaker.setDataType('sql');
145
+ expect(jfaker.getDataType()).to.equal('sql');
146
+
147
+ const data1 = jfaker.person.firstName();
148
+ const data2 = jfaker.person.lastName();
149
+
150
+ expect(data1).to.be.a('string');
151
+ expect(data2).to.be.a('string');
152
+ expect(jfaker.getDataType()).to.equal('sql');
153
+ });
154
+
155
+ it('should allow switching between different injection types', () => {
156
+ jfaker.setDataType('xss');
157
+ const xssData = jfaker.person.firstName();
158
+
159
+ jfaker.setDataType('sql');
160
+ const sqlData = jfaker.person.firstName();
161
+
162
+ jfaker.setDataType('faker');
163
+ const fakerData = jfaker.person.firstName();
164
+
165
+ expect(xssData).to.be.a('string');
166
+ expect(sqlData).to.be.a('string');
167
+ expect(fakerData).to.be.a('string');
168
+ });
169
+ });
170
+
171
+ describe('Safe Option', () => {
172
+ it('should force faker generation when safe is true and global type is injection', () => {
173
+ jfaker.setDataType('xss');
174
+
175
+ const injectionData = jfaker.person.firstName();
176
+ const fakerData = jfaker.person.firstName({safe: true});
177
+
178
+ expect(injectionData).to.be.a('string');
179
+ expect(fakerData).to.be.a('string');
180
+ // Both should be strings but faker data should look more realistic
181
+ });
182
+
183
+ it('should not pass safe option to faker methods', () => {
184
+ // This test ensures safe doesn't cause errors in faker
185
+ const data = jfaker.lorem.sentence({safe: false});
186
+ expect(data).to.be.a('string');
187
+ expect(data.length).to.be.greaterThan(0);
188
+ });
189
+
190
+ it('should work with safe and other options combined', () => {
191
+ jfaker.setDataType('xss');
192
+ const email = jfaker.internet.email({provider: 'test.com', safe: true});
193
+ expect(email).to.include('@test.com');
194
+ });
195
+
196
+ it('should work with safe and length option for faker', () => {
197
+ jfaker.setDataType('sql');
198
+ const alpha = jfaker.string.alpha({length: 15, safe: true});
199
+ expect(alpha).to.have.lengthOf(15);
200
+ });
201
+ });
202
+
203
+ describe('Edge Cases', () => {
204
+ it('should handle empty options object', () => {
205
+ const data = jfaker.person.firstName({});
206
+ expect(data).to.be.a('string');
207
+ });
208
+
209
+ it('should handle no arguments at all', () => {
210
+ const data = jfaker.person.firstName();
211
+ expect(data).to.be.a('string');
212
+ });
213
+
214
+ it('should handle deep nesting of faker entities', () => {
215
+ const data = jfaker.location.country();
216
+ expect(data).to.be.a('string');
217
+ });
218
+
219
+ it('should handle injection calls with no arguments', () => {
220
+ const xssData = jfaker.xss();
221
+ const sqlData = jfaker.sql();
222
+
223
+ expect(xssData).to.be.a('string');
224
+ expect(sqlData).to.be.a('string');
225
+ });
226
+
227
+ it('should handle very large length for injections', () => {
228
+ const data = jfaker.xss({length: 1000});
229
+ expect(data).to.have.lengthOf(1000);
230
+ });
231
+
232
+ it('should handle length 1 for injections', () => {
233
+ const data = jfaker.chars({length: 1});
234
+ expect(data).to.have.lengthOf(1);
235
+ });
236
+ });
237
+
238
+ describe('Data Type Consistency', () => {
239
+ it('should always return strings', () => {
240
+ const tests = [
241
+ jfaker.person.firstName(),
242
+ jfaker.xss(),
243
+ jfaker.sql({length: 10}),
244
+ jfaker.internet.email({provider: 'test.com'}),
245
+ jfaker.escape('test')
246
+ ];
247
+
248
+ tests.forEach(result => {
249
+ expect(result).to.be.a('string');
250
+ });
251
+ });
252
+
253
+ it('should return non-empty strings for valid calls', () => {
254
+ const tests = [
255
+ jfaker.person.firstName(),
256
+ jfaker.xss(),
257
+ jfaker.lorem.sentence()
258
+ ];
259
+
260
+ tests.forEach(result => {
261
+ expect(result.length).to.be.greaterThan(0);
262
+ });
263
+ });
264
+ });
265
+
266
+ describe('Randomness and Uniqueness', () => {
267
+ it('should generate different values on subsequent calls (faker)', () => {
268
+ const values = new Set();
269
+ for (let i = 0; i < 10; i++) {
270
+ values.add(jfaker.person.firstName());
271
+ }
272
+ // With faker, we should get at least some different values
273
+
274
+ expect(values.size).to.be.greaterThan(1);
275
+ });
276
+
277
+ it('should generate varied injection data', () => {
278
+ const values = new Set();
279
+ for (let i = 0; i < 10; i++) {
280
+ values.add(jfaker.xss());
281
+ }
282
+ // Should have some variety (though might occasionally be the same)
283
+
284
+ expect(values.size).to.be.greaterThan(0);
285
+ });
286
+ });
287
+
288
+ describe('Integration Scenarios', () => {
289
+ it('should work in a complete workflow', () => {
290
+ // Start with faker
291
+ const name = jfaker.person.firstName();
292
+ expect(name).to.be.a('string');
293
+
294
+ // Switch to XSS testing
295
+ jfaker.setDataType('xss');
296
+ const xssName = jfaker.person.firstName();
297
+ expect(xssName).to.be.a('string');
298
+
299
+ // Force faker for specific field even though global is XSS
300
+ const email = jfaker.internet.email({provider: 'example.com', safe: true});
301
+ expect(email).to.include('@example.com');
302
+
303
+ // Use direct injection
304
+ const xssPayload = jfaker.xss({length: 50});
305
+ expect(xssPayload).to.have.lengthOf(50);
306
+
307
+ // Back to faker
308
+ jfaker.setDataType('faker');
309
+ const normalName = jfaker.person.lastName();
310
+ expect(normalName).to.be.a('string');
311
+ });
312
+
313
+ it('should support complex form filling scenario', () => {
314
+ const formData = {
315
+ firstName: jfaker.person.firstName(),
316
+ lastName: jfaker.person.lastName(),
317
+ email: jfaker.internet.email(),
318
+ phone: jfaker.phone.number(),
319
+ address: jfaker.location.streetAddress(),
320
+ city: jfaker.location.city(),
321
+ zipCode: jfaker.location.zipCode(),
322
+ bio: jfaker.lorem.paragraph()
323
+ };
324
+
325
+ Object.values(formData).forEach(value => {
326
+ expect(value).to.be.a('string');
327
+ expect(value.length).to.be.greaterThan(0);
328
+ });
329
+ });
330
+
331
+ it('should support injection testing scenario', () => {
332
+ jfaker.setDataType('xss');
333
+
334
+ const testData = {
335
+ scriptInjection: jfaker.person.firstName(),
336
+ longPayload: jfaker.xss({length: 200}),
337
+ sqlInjection: jfaker.sql({length: 100}),
338
+ bashInjection: jfaker.bash(),
339
+ specialChars: jfaker.chars({length: 30})
340
+ };
341
+
342
+ Object.values(testData).forEach(value => {
343
+ expect(value).to.be.a('string');
344
+ expect(value.length).to.be.greaterThan(0);
345
+ });
346
+ });
347
+ });
348
+
349
+ describe('Error Handling', () => {
350
+ it('should handle invalid data type gracefully', () => {
351
+ // Setting invalid type - should still work but use as-is
352
+ jfaker.setDataType('invalid_type');
353
+ expect(jfaker.getDataType()).to.equal('invalid_type');
354
+ });
355
+
356
+ it('should handle escape with special characters', () => {
357
+ const specialChars = '\\n\\t\\r\\"\\\'';
358
+ const escaped = jfaker.escape(specialChars);
359
+ expect(escaped).to.be.a('string');
360
+ });
361
+
362
+ it('should handle escape with unicode characters', () => {
363
+ const unicode = '你好世界 🌍';
364
+ const escaped = jfaker.escape(unicode);
365
+ expect(escaped).to.be.a('string');
366
+ });
367
+ });
368
+
369
+ describe('Performance and Scalability', () => {
370
+ it('should handle rapid successive calls', () => {
371
+ const results = [];
372
+ for (let i = 0; i < 100; i++) {
373
+ results.push(jfaker.person.firstName());
374
+ }
375
+
376
+ expect(results).to.have.lengthOf(100);
377
+ results.forEach(result => {
378
+ expect(result).to.be.a('string');
379
+ });
380
+ });
381
+
382
+ it('should handle large batch injection generation', () => {
383
+ const injections = [];
384
+ for (let i = 0; i < 50; i++) {
385
+ injections.push(jfaker.xss({length: 100}));
386
+ }
387
+
388
+ expect(injections).to.have.lengthOf(50);
389
+ injections.forEach(injection => {
390
+ expect(injection).to.have.lengthOf(100);
391
+ });
392
+ });
393
+ });
394
+
395
+ describe('Type Switching Performance', () => {
396
+ it('should handle frequent type switches', () => {
397
+ const types = ['faker', 'xss', 'sql', 'bash', 'faker'];
398
+ const results: string[] = [];
399
+
400
+ types.forEach(type => {
401
+ jfaker.setDataType(type);
402
+ results.push(jfaker.person.firstName());
403
+ });
404
+
405
+ expect(results).to.have.lengthOf(types.length);
406
+ results.forEach(result => {
407
+ expect(result).to.be.a('string');
408
+ });
409
+ });
410
+ });
411
+ });