Skip to content

Commit

Permalink
Fix find-on-shelf test after changing API from /holdings/3 to `/h…
Browse files Browse the repository at this point in the history
…oldingsLogistics/v1`

The current test fixtures appear to be manually created. I’ve updated them to reflect the new structure, but I suggest refactoring this test in the future. Ideally, it should be tested directly from the material app instead of relying on this "artificial" environment.
  • Loading branch information
kasperbirch1 committed Nov 14, 2024
1 parent ccd7c39 commit 53afae3
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 28 deletions.
93 changes: 73 additions & 20 deletions cypress/fixtures/material/find-on-shelf-holdings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"reservations": 48,
"holdings": [
{
"branch": { "branchId": "DK-775127", "title": "Tranbjerg" },
"department": { "departmentId": "vo", "title": "Voksen" },
"location": null,
"sublocation": null,
"branch": {
"branchId": "DK-775127",
"title": "Tranbjerg"
},
"lmsPlacement": {
"location": null,
"sublocation": null,
"department": {
"departmentId": "vo",
"title": "Voksen"
},
"section": null
},
"logisticsPlacement": [],
"materials": [
{
"itemNumber": "5313131426",
Expand All @@ -27,10 +37,20 @@
]
},
{
"branch": { "branchId": "DK-775127", "title": "Tranbjerg" },
"department": { "departmentId": "vo", "title": "Voksen" },
"location": null,
"sublocation": null,
"branch": {
"branchId": "DK-775127",
"title": "Tranbjerg"
},
"lmsPlacement": {
"location": null,
"sublocation": null,
"department": {
"departmentId": "vo",
"title": "Voksen"
},
"section": null
},
"logisticsPlacement": [],
"materials": [
{
"itemNumber": "5313137426",
Expand All @@ -49,10 +69,20 @@
]
},
{
"branch": { "branchId": "DK-775122", "title": "Beder-Malling" },
"department": { "departmentId": "vo", "title": "Voksen" },
"location": null,
"sublocation": null,
"branch": {
"branchId": "DK-775122",
"title": "Beder-Malling"
},
"lmsPlacement": {
"location": null,
"sublocation": null,
"department": {
"departmentId": "vo",
"title": "Voksen"
},
"section": null
},
"logisticsPlacement": [],
"materials": [
{
"itemNumber": "5313131418",
Expand All @@ -71,10 +101,20 @@
]
},
{
"branch": { "branchId": "DK-775100", "title": "Hovedbiblioteket" },
"department": { "departmentId": "vo", "title": "Voksen" },
"location": null,
"sublocation": null,
"branch": {
"branchId": "DK-775100",
"title": "Hovedbiblioteket"
},
"lmsPlacement": {
"location": null,
"sublocation": null,
"department": {
"departmentId": "vo",
"title": "Voksen"
},
"section": null
},
"logisticsPlacement": [],
"materials": [
{
"itemNumber": "5258721529",
Expand All @@ -93,10 +133,23 @@
]
},
{
"branch": { "branchId": "DK-775122", "title": "Beder-Malling" },
"department": { "departmentId": "vo", "title": "Voksen" },
"location": { "locationId": "læs", "title": "Læsesal" },
"sublocation": null,
"branch": {
"branchId": "DK-775122",
"title": "Beder-Malling"
},
"lmsPlacement": {
"location": {
"locationId": "læs",
"title": "Læsesal"
},
"sublocation": null,
"department": {
"departmentId": "vo",
"title": "Voksen"
},
"section": null
},
"logisticsPlacement": [],
"materials": [
{
"itemNumber": "5313126015",
Expand Down
24 changes: 16 additions & 8 deletions src/components/find-on-shelf/find-on-shelf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ describe("Find on shelf modal - default", () => {
// Intercept holdings data call.
cy.fixture("material/find-on-shelf-holdings.json")
.then((result) => {
cy.intercept("GET", "**/external/agencyid/catalog/holdings/**", {
statusCode: 200,
body: result
});
cy.intercept(
"GET",
"**/external/agencyid/catalog/holdingsLogistics/**",
{
statusCode: 200,
body: result
}
);
})
.as("Find on shelf holdings");
// Intercept availability data call.
Expand Down Expand Up @@ -39,10 +43,14 @@ describe("Find on shelf modal - periodical", () => {
// Intercept holdings data call.
cy.fixture("material/find-on-shelf-holdings.json")
.then((result) => {
cy.intercept("GET", "**/external/agencyid/catalog/holdings/**", {
statusCode: 200,
body: result
});
cy.intercept(
"GET",
"**/external/agencyid/catalog/holdingsLogistics/**",
{
statusCode: 200,
body: result
}
);
})
.as("Find on shelf holdings");
// Intercept availability data call.
Expand Down

0 comments on commit 53afae3

Please sign in to comment.