mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 13:42:49 +01:00
22 lines
547 B
JavaScript
22 lines
547 B
JavaScript
|
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);
|
||
|
},
|
||
|
};
|