Bugzilla – Attachment 176792 Details for
Bug 38503
Add a Cypress task to generate objects based on its swagger def spec
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38503: Do not generate too long strings
Bug-38503-Do-not-generate-too-long-strings.patch (text/plain), 1.53 KB, created by
Jonathan Druart
on 2025-01-20 12:44:51 UTC
(
hide
)
Description:
Bug 38503: Do not generate too long strings
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-20 12:44:51 UTC
Size:
1.53 KB
patch
obsolete
>From ccc001d605e0585e187336a49cff9c5d6d15382e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 20 Jan 2025 13:38:34 +0100 >Subject: [PATCH] Bug 38503: Do not generate too long strings > >--- > t/cypress/plugins/mockData.js | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/t/cypress/plugins/mockData.js b/t/cypress/plugins/mockData.js >index 6cd20ed1087..47a239a4d25 100644 >--- a/t/cypress/plugins/mockData.js >+++ b/t/cypress/plugins/mockData.js >@@ -2,12 +2,15 @@ const { faker } = require("@faker-js/faker"); > const { readYamlFile } = require("./../plugins/readYamlFile.js"); > const fs = require('fs'); > >-const generateMockData = type => { >+const generateMockData = (type, properties) => { > if (Array.isArray(type)) { > type = type.filter(t => t != '"null"')[0]; > } > switch (type) { > case "string": >+ if(properties?.maxLength){ >+ return faker.string.alpha({ length: { min: properties.minLength || 1, max: properties.maxLength } }) >+ } > return faker.lorem.words(3); > case "integer": > return faker.number.int(); >@@ -36,7 +39,7 @@ const generateDataFromSchema = (properties, values = {}) => { > value?.format == "date" || value?.format == "date-time" > ? value.format > : value.type; >- mockData[key] = generateMockData(type); >+ mockData[key] = generateMockData(type, value); > } > }); > return mockData; >-- >2.34.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 38503
:
174872
|
174873
|
174874
|
174875
|
174876
|
174884
|
174885
|
174921
|
174922
|
175173
|
175175
|
175212
|
175213
|
175214
|
175215
|
175216
|
175217
|
175218
|
175219
|
175220
|
175221
|
175222
|
175888
|
175889
|
175890
|
175891
|
175892
|
175893
|
175894
|
175895
|
175896
|
176073
|
176074
|
176075
|
176076
|
176077
|
176078
|
176079
|
176080
|
176081
|
176775
|
176776
| 176792