From 355054aaa89077ed55cdc8b03eb181ccfddb4125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Fri, 14 Sep 2018 17:11:52 +0200 Subject: [PATCH] [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) --- addons/mail/static/tests/helpers/mock_server.js | 2 -- addons/web/static/tests/helpers/test_utils.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/mail/static/tests/helpers/mock_server.js b/addons/mail/static/tests/helpers/mock_server.js index c56d354d84e..d8201c4e9a5 100644 --- a/addons/mail/static/tests/helpers/mock_server.js +++ b/addons/mail/static/tests/helpers/mock_server.js @@ -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) { diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 5bf8e3d2e1b..6ca27233835 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -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, });