* Update .prettierrc - remove "arrowParens": "avoid" so that it defaults to "always" instead * Run "yarn prettier"
21 lines
568 B
JavaScript
21 lines
568 B
JavaScript
function mockProperty(propertyOrObject, value, url) {
|
|
cy.intercept("GET", url, (req) => {
|
|
req.reply((res) => {
|
|
if (typeof propertyOrObject === "object") {
|
|
Object.assign(res.body, propertyOrObject);
|
|
}
|
|
{
|
|
res.body[propertyOrObject] = value;
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
export function mockSessionProperty(propertyOrObject, value) {
|
|
mockProperty(propertyOrObject, value, "/api/session/properties");
|
|
}
|
|
|
|
export function mockCurrentUserProperty(propertyOrObject, value) {
|
|
mockProperty(propertyOrObject, value, "/api/user/current");
|
|
}
|