Bugzilla – Attachment 184331 Details for
Bug 40174
Add a way to cleanly insert data in DB from Cypress tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40174: Set minLength to 3
Bug-40174-Set-minLength-to-3.patch (text/plain), 1.98 KB, created by
Martin Renvoize (ashimema)
on 2025-07-18 11:21:56 UTC
(
hide
)
Description:
Bug 40174: Set minLength to 3
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-18 11:21:56 UTC
Size:
1.98 KB
patch
obsolete
>From 3feb67d6416e4ac519bc490b22e7d3c4855a2878 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 11 Jul 2025 10:21:56 +0200 >Subject: [PATCH] Bug 40174: Set minLength to 3 > >When we generate several objects we often get "Duplicate ID" from the >server. This mostly happens when the tests failed previously and the >objects have not been removed from the DB. > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/cypress/plugins/mockData.js | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > >diff --git a/t/cypress/plugins/mockData.js b/t/cypress/plugins/mockData.js >index 8131eb332ef..174564a12ee 100644 >--- a/t/cypress/plugins/mockData.js >+++ b/t/cypress/plugins/mockData.js >@@ -14,9 +14,24 @@ const generateMockData = (type, properties) => { > switch (type) { > case "string": > if (properties?.maxLength) { >+ // The propability to have a string with length=1 is the same as length=10 >+ // We have very limited pool of possible values for length=1 which will result in a "Duplicate ID" error from the server >+ // Setting minLength to 3 to prevent this kind of failures >+ let minLength = >+ properties.minLength === 1 || >+ properties.minLength === undefined >+ ? 3 >+ : properties.minLength; >+ >+ if ( >+ properties.maxLength !== undefined && >+ properties.maxLength < minLength >+ ) { >+ minLength = properties.maxLength; >+ } > return (value = faker.string.alpha({ > length: { >- min: properties.minLength || 1, >+ min: minLength, > max: properties.maxLength, > }, > })); >-- >2.50.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40174
:
183372
|
183373
|
183374
|
183851
|
183929
|
183978
|
183980
|
183981
|
184103
|
184104
|
184105
|
184106
|
184107
|
184108
|
184195
|
184327
|
184328
|
184329
|
184330
| 184331 |
184332
|
184333