Skip to content

Commit

Permalink
re-do normaliser
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate committed Jun 3, 2024
1 parent f773cce commit 9458a2c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 321 deletions.
27 changes: 26 additions & 1 deletion cypress-tests/cypress/e2e/ConnectorUtils/Commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,32 @@ const globalState = new State({
connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),
});

const connectorId = globalState.get("connectorId");
const connectorId = normalise(globalState.get("connectorId"));

function normalise(input) {
const exceptions = {
bankofamerica: "Bank of America",
nmi: "NMI",
// Add more known exceptions here
};

if (exceptions[input.toLowerCase()]) {
return exceptions[input.toLowerCase()];
}

// Split the input text based on changes from lowercase to uppercase or delimiters
const words = input.match(/[A-Z][a-z]+|[a-z]+/g);
if (!words) {
return input;
}

// Capitalize the first letter of each word and join them with spaces
const result = words
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");

return result;
}

const successfulNo3DSCardDetails = {
card_number: "4111111111111111",
Expand Down
2 changes: 1 addition & 1 deletion cypress-tests/cypress/support/redirectionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function bankRedirectRedirection(
cy.get("button.cookie-modal-deny-all.button-tertiary")
.should("be.visible")
.should("contain", "Reject All")
.click({ force: true, multiple: true });
.click({ force: true });
cy.get("div#TopBanks.top-banks-multistep")
.should("contain", "Demo Bank")
.as("btn")
Expand Down
319 changes: 0 additions & 319 deletions cypress-tests/cypress/support/redirectionhandler.js

This file was deleted.

0 comments on commit 9458a2c

Please sign in to comment.