1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/tests/cypress/support/laravel-routes.js
2023-01-25 07:15:54 +11:00

22 lines
547 B
JavaScript
Vendored

Cypress.Laravel = {
routes: {},
route: (name, parameters = {}) => {
assert(
Cypress.Laravel.routes.hasOwnProperty(name),
`Laravel route "${name}" does not exist.`
);
return ((uri) => {
Object.keys(parameters).forEach((parameter) => {
uri = uri.replace(
new RegExp(`{${parameter}}`),
parameters[parameter]
);
});
return uri;
})(Cypress.Laravel.routes[name].uri);
},
};