Bugzilla – Attachment 174874 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: Same for libraries
Bug-38503-Same-for-libraries.patch (text/plain), 2.79 KB, created by
Jonathan Druart
on 2024-11-21 13:45:11 UTC
(
hide
)
Description:
Bug 38503: Same for libraries
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-11-21 13:45:11 UTC
Size:
2.79 KB
patch
obsolete
>From 17134bd7156ea2a793e3bf488b4c315d905fa510 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Nov 2024 14:06:41 +0100 >Subject: [PATCH] Bug 38503: Same for libraries > >--- > t/cypress/integration/t/mockData.ts | 17 +++++++++++++++++ > t/cypress/plugins/index.js | 9 ++++++++- > t/cypress/plugins/mockData.js | 14 ++++++++++++++ > 3 files changed, 39 insertions(+), 1 deletion(-) > >diff --git a/t/cypress/integration/t/mockData.ts b/t/cypress/integration/t/mockData.ts >index 22379c3ff0d..3ca84da9208 100644 >--- a/t/cypress/integration/t/mockData.ts >+++ b/t/cypress/integration/t/mockData.ts >@@ -16,3 +16,20 @@ describe("Generate Random Patrons", () => { > }); > }); > }); >+ >+describe("Generate Random Library", () => { >+ it("should generate a random library from the schema", () => { >+ cy.task("buildSampleLibrary").then(mockLibrary => { >+ expect(mockLibrary).to.have.property("library_id"); >+ }); >+ }); >+}); >+ >+describe("Generate Random Libraries", () => { >+ it("should generate 42 random library from the schema", () => { >+ cy.task("buildSampleLibraries", 42).then(mockLibraries => { >+ expect(mockLibraries.length).to.equal(42); >+ expect(mockLibraries[0]).to.have.property("library_id"); >+ }); >+ }); >+}); >diff --git a/t/cypress/plugins/index.js b/t/cypress/plugins/index.js >index be07e4fe8ed..990b98bc174 100644 >--- a/t/cypress/plugins/index.js >+++ b/t/cypress/plugins/index.js >@@ -18,12 +18,19 @@ module.exports = (on, config) => { > mysql.configurePlugin(on); > }; > >-const { buildSamplePatron, buildSamplePatrons } = require("./mockData.js"); >+const { >+ buildSamplePatron, >+ buildSamplePatrons, >+ buildSampleLibrary, >+ buildSampleLibraries, >+} = require("./mockData.js"); > > module.exports = (on, config) => { > on("task", { > buildSamplePatron, > buildSamplePatrons, >+ buildSampleLibrary, >+ buildSampleLibraries, > }); > return config; > }; >diff --git a/t/cypress/plugins/mockData.js b/t/cypress/plugins/mockData.js >index abcf0adc03e..a0b2d56a118 100644 >--- a/t/cypress/plugins/mockData.js >+++ b/t/cypress/plugins/mockData.js >@@ -38,9 +38,23 @@ const buildSamplePatron = () => { > return buildSamplePatrons()[0]; > }; > >+const buildSampleLibraries = (count = 1) => { >+ const yamlPath = "api/v1/swagger/definitions/library.yaml"; >+ const schema = readYamlFile(yamlPath); >+ return Array.from({ length: count }, () => >+ generateDataFromSchema(schema.properties) >+ ); >+}; >+ >+const buildSampleLibrary = () => { >+ return buildSampleLibraries()[0]; >+}; >+ > module.exports = { > generateMockData, > generateDataFromSchema, > buildSamplePatron, > buildSamplePatrons, >+ buildSampleLibrary, >+ buildSampleLibraries, > }; >-- >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