Bugzilla – Attachment 183974 Details for
Bug 40345
Missing Cypress tests for checkout history - OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40345: Pass a patron to insertSampleCheckout
Bug-40345-Pass-a-patron-to-insertSampleCheckout.patch (text/plain), 4.42 KB, created by
Jonathan Druart
on 2025-07-11 07:22:29 UTC
(
hide
)
Description:
Bug 40345: Pass a patron to insertSampleCheckout
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-11 07:22:29 UTC
Size:
4.42 KB
patch
obsolete
>From fdb419a52b890984b9bc2022a9d03699333b56eb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Jul 2025 15:11:23 +0200 >Subject: [PATCH] Bug 40345: Pass a patron to insertSampleCheckout > >So we won't generate a new patron per checkout >--- > t/cypress/integration/t/insertData.ts | 35 ++++++++++++++++++++ > t/cypress/plugins/insertData.js | 46 ++++++++++++++++----------- > 2 files changed, 63 insertions(+), 18 deletions(-) > >diff --git a/t/cypress/integration/t/insertData.ts b/t/cypress/integration/t/insertData.ts >index 745137fee26..8eb4e26235b 100644 >--- a/t/cypress/integration/t/insertData.ts >+++ b/t/cypress/integration/t/insertData.ts >@@ -230,6 +230,41 @@ describe("insertData", () => { > cy.task("deleteSampleObjects", objects_checkout); > }); > }); >+ >+ it("insertSampleCheckout - pass an already generated patron", () => { >+ cy.task("buildSampleObject", { >+ object: "patron", >+ values: { >+ incorrect_address: null, >+ patron_card_lost: null, >+ }, >+ }).then(generatedPatron => { >+ cy.task("insertObject", { >+ type: "patron", >+ object: generatedPatron, >+ }).then(patron => { >+ cy.task("insertSampleCheckout", { patron }).then( >+ objects_checkout => { >+ expect(objects_checkout.patron).to.not.exists; >+ cy.task("apiGet", { >+ endpoint: `/api/v1/checkouts/${objects_checkout.checkout.checkout_id}`, >+ }).then(checkout => { >+ expect(checkout.item_id).to.be.equal( >+ objects_checkout.items[0].item_id >+ ); >+ expect(checkout.patron_id).to.be.equal( >+ generatedPatron.patron_id >+ ); >+ }); >+ cy.task("deleteSampleObjects", [ >+ objects_checkout, >+ { patron }, >+ ]); >+ } >+ ); >+ }); >+ }); >+ }); > }); > > afterEach(function () { >diff --git a/t/cypress/plugins/insertData.js b/t/cypress/plugins/insertData.js >index 61705a01f66..c92aded59cd 100644 >--- a/t/cypress/plugins/insertData.js >+++ b/t/cypress/plugins/insertData.js >@@ -205,29 +205,31 @@ const insertSampleHold = async ({ > return { hold, patron }; > }; > >-const insertSampleCheckout = async ({ baseUrl, authHeader }) => { >+const insertSampleCheckout = async ({ patron, baseUrl, authHeader }) => { > const { biblio, items, libraries, item_type } = await insertSampleBiblio({ > item_count: 1, > baseUrl, > authHeader, > }); >- const generatedPatron = await buildSampleObject({ >- object: "patron", >- values: { >- library_id: libraries[0].library_id, >- incorrect_address: null, >- patron_card_lost: null, >- }, >- baseUrl, >- authHeader, >- }); > >- const patron = await insertObject({ >- type: "patron", >- object: generatedPatron, >- baseUrl, >- authHeader, >- }); >+ let generatedPatron; >+ if (!patron) { >+ generatedPatron = await buildSampleObject({ >+ object: "patron", >+ values: { >+ library_id: libraries[0].library_id, >+ incorrect_address: null, >+ patron_card_lost: null, >+ }, >+ }); >+ >+ patron = await insertObject({ >+ type: "patron", >+ object: generatedPatron, >+ baseUrl, >+ authHeader, >+ }); >+ } > > const generatedCheckout = buildSampleObject({ > object: "checkout", >@@ -243,7 +245,15 @@ const insertSampleCheckout = async ({ baseUrl, authHeader }) => { > baseUrl, > authHeader, > }); >- return { biblio, items, libraries, item_type, patron, checkout }; >+ return { >+ biblio, >+ items, >+ libraries, >+ item_type, >+ patron, >+ checkout, >+ ...(generatedPatron ? { patron: generatedPatron } : {}), >+ }; > }; > > const deleteSampleObjects = async allObjects => { >-- >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 40345
:
183974
|
183975
|
183976
|
183977
|
183979
|
183983
|
183984
|
183985
|
183986
|
183987
|
183988