Skip to content

Commit

Permalink
Make sure that the renew request is intercepted
Browse files Browse the repository at this point in the history
We need it for the dashboard renewal flow
  • Loading branch information
spaceo committed Oct 8, 2023
1 parent f713496 commit ce380af
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/apps/dashboard/dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,50 @@ describe("Dashboard", () => {
}
}).as("work");

cy.intercept(
"POST",
"**/external/agencyid/patrons/patronid/loans/renew/v2",
{
statusCode: 200,
body: [
{
renewalStatus: ["deniedMaterialIsNotLoanable"],
loanDetails: {
loanId: 956250508,
materialItemNumber: "3846990827",
recordId: "28847238",
periodical: null,
loanDate: "2022-06-13T16:43:25.325",
dueDate: "2023-10-12",
loanType: "loan",
ilBibliographicRecord: null,
materialGroup: {
name: "fon2",
description: "Flere CD-plader"
}
}
},
{
renewalStatus: ["deniedReserved"],
loanDetails: {
loanId: 956250508,
materialItemNumber: "3846990827",
recordId: "53667546",
periodical: null,
loanDate: "2022-06-13T16:43:25.325",
dueDate: "2023-10-12",
loanType: "loan",
ilBibliographicRecord: null,
materialGroup: {
name: "fon2",
description: "Flere CD-plader"
}
}
}
]
}
).as("renew");

cy.visit("/iframe.html?id=apps-dashboard--dashboard-entry&viewMode=story");
cy.wait(["@fees", "@loans", "@reservations"]);
});
Expand Down
44 changes: 44 additions & 0 deletions src/apps/loan-list/list/loan-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,50 @@ describe("Loan list", () => {
message: "OK"
}).as("product");

cy.intercept(
"POST",
"**/external/agencyid/patrons/patronid/loans/renew/v2",
{
statusCode: 200,
body: [
{
renewalStatus: ["deniedMaterialIsNotLoanable"],
loanDetails: {
loanId: 956250508,
materialItemNumber: "3846990827",
recordId: "28847238",
periodical: null,
loanDate: "2022-06-13T16:43:25.325",
dueDate: "2023-10-12",
loanType: "loan",
ilBibliographicRecord: null,
materialGroup: {
name: "fon2",
description: "Flere CD-plader"
}
}
},
{
renewalStatus: ["deniedReserved"],
loanDetails: {
loanId: 956250508,
materialItemNumber: "3846990827",
recordId: "53667546",
periodical: null,
loanDate: "2022-06-13T16:43:25.325",
dueDate: "2023-10-12",
loanType: "loan",
ilBibliographicRecord: null,
materialGroup: {
name: "fon2",
description: "Flere CD-plader"
}
}
}
]
}
).as("renew");

cy.visit("/iframe.html?path=/story/apps-loan-list--loan-list-entry");
cy.wait(["@physical_loans", "@digital_loans", "@work", "@cover"], {
timeout: 10000
Expand Down

0 comments on commit ce380af

Please sign in to comment.