Bug 40344: Fix KohaTable_spec.ts

> Cannot read properties of undefined (reading 'description')

Not sure since which change this is failing but it has always been
wrong.

The code in patron-search.inc is:
        var categories = [% To.json(categories) | $raw %].map(e => {
            e['_id'] = e.categorycode.toLowerCase();
            e['_str'] = e.description;
            return e;
        });
        var categories_map = categories.reduce((map, e) => {
            map[e._id] = e;
            return map;
        }, {});

It's the keys that are lower cased.

Test plan:

  `yarn cypress run \
    --config video=false,screenshotOnRunFailure=false \
    --spec t/cypress/integration/KohaTable/KohaTable_spec.ts`
should return green

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-07-11 06:30:26 +02:00 committed by Lucas Gass
parent 4bd5b58cd9
commit 7bc3b24827
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ describe("kohaTable (using REST API)", () => {
cy.window().then(win => {
win.categories_map = patrons.reduce((map, p) => {
map[p.category_id] = p.category_id;
map[p.category_id.toLowerCase()] = p.category_id;
return map;
}, {});
});
@ -399,7 +399,7 @@ describe("kohaTable (using REST API)", () => {
cy.window().then(win => {
win.categories_map = patrons.reduce((map, p) => {
map[p.category_id] = p.category_id;
map[p.category_id.toLowerCase()] = p.category_id;
return map;
}, {});
});