View | Details | Raw Unified | Return to bug 40174
Collapse All | Expand All

(-)a/t/cypress/plugins/mockData.js (-2 / +16 lines)
Lines 14-22 const generateMockData = (type, properties) => { Link Here
14
    switch (type) {
14
    switch (type) {
15
        case "string":
15
        case "string":
16
            if (properties?.maxLength) {
16
            if (properties?.maxLength) {
17
                // The propability to have a string with length=1 is the same as length=10
18
                // We have very limited pool of possible values for length=1 which will result in a "Duplicate ID" error from the server
19
                // Setting minLength to 3 to prevent this kind of failures
20
                let minLength =
21
                    properties.minLength === 1 ||
22
                    properties.minLength === undefined
23
                        ? 3
24
                        : properties.minLength;
25
26
                if (
27
                    properties.maxLength !== undefined &&
28
                    properties.maxLength < minLength
29
                ) {
30
                    minLength = properties.maxLength;
31
                }
17
                return (value = faker.string.alpha({
32
                return (value = faker.string.alpha({
18
                    length: {
33
                    length: {
19
                        min: properties.minLength || 1,
34
                        min: minLength,
20
                        max: properties.maxLength,
35
                        max: properties.maxLength,
21
                    },
36
                    },
22
                }));
37
                }));
23
- 

Return to bug 40174