summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-09-14 17:11:52 +0200
committerAlexandre Kühn <aku@odoo.com>2018-09-14 17:14:33 +0200
commit355054aaa89077ed55cdc8b03eb181ccfddb4125 (patch)
tree0f46ce119997973b47d2467036929865aa82dfce
parent45d197c2087e61e702f288f76ccbf99bdd9b235d (diff)
[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)
-rw-r--r--addons/mail/static/tests/helpers/mock_server.js2
-rw-r--r--addons/web/static/tests/helpers/test_utils.js4
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,
});