1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/tests/cypress/support/laravel-routes.js

22 lines
547 B
JavaScript
Raw Normal View History

2023-01-24 21:15:54 +01:00
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);
},
};