[FIX] web:tests: correctly handle parameter 'services'
This commit fixes the handling of the service parameter in a mocked environment: - updated docstring: now an object (previously an array) - no longer used by mocked server (unused parameter) - enforces default value for this parameter (empty object)
This commit is contained in:
@@ -13,8 +13,6 @@ MockServer.include({
|
||||
*
|
||||
* @override
|
||||
* @param {Object} [data.initMessaging] init messaging data
|
||||
* @param {Object} [options.services] list of extra services to load for
|
||||
* the tests (e.g. MailService or BusService)
|
||||
* @param {Widget} [options.widget] mocked widget (use to call services)
|
||||
*/
|
||||
init: function (data, options) {
|
||||
|
||||
@@ -373,7 +373,7 @@ function patchDate(year, month, day, hours, minutes, seconds) {
|
||||
* up in the init process of the view, because there are no other way to do it
|
||||
* after this method returns. Some events ('call_service', "load_views",
|
||||
* "get_session", "load_filters") have a special treatment beforehand.
|
||||
* @param {web.AbstractService[]} [params.services] list of services to load in
|
||||
* @param {Object} [params.services={}] list of services to load in
|
||||
* addition to the ajax service. For instance, if a test needs the local
|
||||
* storage service in order to work, it can provide a mock version of it.
|
||||
* @param {boolean} [debounce=true] set to false to completely remove the
|
||||
@@ -388,6 +388,7 @@ function patchDate(year, month, day, hours, minutes, seconds) {
|
||||
*/
|
||||
function addMockEnvironment(widget, params) {
|
||||
var Server = MockServer;
|
||||
params.services = params.services || {};
|
||||
if (params.mockRPC) {
|
||||
Server = MockServer.extend({_performRpc: params.mockRPC});
|
||||
}
|
||||
@@ -403,7 +404,6 @@ function addMockEnvironment(widget, params) {
|
||||
archs: params.archs,
|
||||
currentDate: params.currentDate,
|
||||
debug: params.debug,
|
||||
services: params.services,
|
||||
widget: widget,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user