Files
odoo_source/addons/website/static/tests/website_service_mock.js
T
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00

51 lines
1.3 KiB
JavaScript

/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { registry } from '@web/core/registry';
import { utils, clearRegistryWithCleanup } from '@web/../tests/helpers/mock_env';
const { prepareRegistriesWithCleanup } = utils;
function makeFakeWebsiteService() {
return {
start() {
return {
get context() {
return {};
},
get isRestrictedEditor() {
return true;
},
get hasMultiWebsites() {
return true;
},
async fetchUserGroups() {},
};
}
};
}
function makeFakeWebsiteCustomMenusService() {
return {
start() {
return {
get() {},
open() {},
addCustomMenus(sections) {
return sections;
},
};
}
};
}
const serviceRegistry = registry.category('services');
patch(utils, {
prepareRegistriesWithCleanup() {
prepareRegistriesWithCleanup(...arguments);
serviceRegistry.add('website', makeFakeWebsiteService());
serviceRegistry.add('website_custom_menus', makeFakeWebsiteCustomMenusService());
clearRegistryWithCleanup(registry.category('website_systray'));
},
});