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