View | Details | Raw Unified | Return to bug 32176
Collapse All | Expand All

(-)a/t/cypress/integration/Patron/Format.ts (-1 / +44 lines)
Lines 49-54 describe("Display patron - search", () => { Link Here
49
            });
49
            });
50
        });
50
        });
51
    });
51
    });
52
53
    it("should have correct punctuation when surname is missing", function () {
54
        cy.task("buildSampleObjects", {
55
            object: "patron",
56
            count: 2,
57
            values: { surname: null },
58
        }).then(patrons => {
59
            // Needs more properties to not explode
60
            // account_balace: balance_str.escapeHtml(...).format_price is not a function
61
            patrons = patrons.map(p => ({ ...p, account_balance: 0 }));
62
63
            cy.intercept("GET", "/api/v1/patrons*", {
64
                statusCode: 200,
65
                body: patrons,
66
                headers: {
67
                    "X-Base-Total-Count": "2",
68
                    "X-Total-Count": "2",
69
                },
70
            });
71
72
            cy.visit("/cgi-bin/koha/members/members-home.pl");
73
74
            cy.window().then(win => {
75
                win.categories_map = patrons.reduce((map, p) => {
76
                    map[p.category_id.toLowerCase()] = p.category_id;
77
                    return map;
78
                }, {});
79
            });
80
81
            cy.get("form.patron_search_form input[type='submit']").click();
82
83
            const patron = patrons[0];
84
            // invert_name is set
85
            cy.get(`#${table_id} tbody tr:eq(0) td:eq(2)`).should($el => {
86
                let re = new RegExp(
87
                    `^${patron.preferred_name} ${patron.middle_name} \\(${patron.other_name}\\)`
88
                );
89
                const displayedText = $el.text().replace(/ /g, " ").trim();
90
                expect(displayedText).to.match(re);
91
                re = new RegExp(patron.cardnumber);
92
                expect(displayedText).to.not.match(re);
93
            });
94
        });
95
    });
52
});
96
});
53
97
54
describe("Display patron - autocomplete", () => {
98
describe("Display patron - autocomplete", () => {
55
- 

Return to bug 32176