Bugzilla – Attachment 175213 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: Implement a plural form - buildSamplePatrons
Bug-38503-Implement-a-plural-form---buildSamplePat.patch (text/plain), 2.47 KB, created by
Victor Grousset/tuxayo
on 2024-12-05 05:53:19 UTC
(
hide
)
Description:
Bug 38503: Implement a plural form - buildSamplePatrons
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-12-05 05:53:19 UTC
Size:
2.47 KB
patch
obsolete
>From b3162f5f2d6dbfc0cef3dfd1db69c2ec75b80cff Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Nov 2024 14:05:33 +0100 >Subject: [PATCH] Bug 38503: Implement a plural form - buildSamplePatrons > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > t/cypress/integration/t/mockData.ts | 9 +++++++++ > t/cypress/plugins/index.js | 3 ++- > t/cypress/plugins/mockData.js | 11 +++++++++-- > 3 files changed, 20 insertions(+), 3 deletions(-) > >diff --git a/t/cypress/integration/t/mockData.ts b/t/cypress/integration/t/mockData.ts >index 4afd0c3320..22379c3ff0 100644 >--- a/t/cypress/integration/t/mockData.ts >+++ b/t/cypress/integration/t/mockData.ts >@@ -7,3 +7,12 @@ describe("Generate Random Patron", () => { > }); > }); > }); >+ >+describe("Generate Random Patrons", () => { >+ it("should generate 42 random patron from the schema", () => { >+ cy.task("buildSamplePatrons", 42).then(mockPatrons => { >+ expect(mockPatrons.length).to.equal(42); >+ expect(mockPatrons[0]).to.have.property("patron_id"); >+ }); >+ }); >+}); >diff --git a/t/cypress/plugins/index.js b/t/cypress/plugins/index.js >index 2936a8f007..be07e4fe8e 100644 >--- a/t/cypress/plugins/index.js >+++ b/t/cypress/plugins/index.js >@@ -18,11 +18,12 @@ module.exports = (on, config) => { > mysql.configurePlugin(on); > }; > >-const { buildSamplePatron } = require("./mockData.js"); >+const { buildSamplePatron, buildSamplePatrons } = require("./mockData.js"); > > module.exports = (on, config) => { > on("task", { > buildSamplePatron, >+ buildSamplePatrons, > }); > return config; > }; >diff --git a/t/cypress/plugins/mockData.js b/t/cypress/plugins/mockData.js >index 0c84043b0a..abcf0adc03 100644 >--- a/t/cypress/plugins/mockData.js >+++ b/t/cypress/plugins/mockData.js >@@ -26,14 +26,21 @@ const generateDataFromSchema = properties => { > return mockData; > }; > >-const buildSamplePatron = () => { >+const buildSamplePatrons = (count = 1) => { > const yamlPath = "api/v1/swagger/definitions/patron.yaml"; > const schema = readYamlFile(yamlPath); >- return generateDataFromSchema(schema.properties); >+ return Array.from({ length: count }, () => >+ generateDataFromSchema(schema.properties) >+ ); >+}; >+ >+const buildSamplePatron = () => { >+ return buildSamplePatrons()[0]; > }; > > module.exports = { > generateMockData, > generateDataFromSchema, > buildSamplePatron, >+ buildSamplePatrons, > }; >-- >2.47.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