diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-13 16:26:35 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-13 16:26:35 +0000 |
| commit | c2918c139b8f1026b57a257fbb74570d7a224c98 (patch) | |
| tree | 6b1a5cbf5b048dd86048119cd66f5fa382595a7b /addons/mail/static/src/components/thread_preview/thread_preview_tests.js | |
| parent | 41527531b7b6f727e25a5a68aedb49609fbb1d3a (diff) | |
[IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server:
- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data
Other changes done in mail (or dependents) that are not just related to tests:
- remove `direct_partner` from formatter result
->`correspondent` can be computed from other keys, especially `members`
- fix `livechat_visitor` convertData
-> only process if there is value
- add `current_partner` and `current_user_id` as `init_messaging` result
-> easier to mock than session
- remove usage of `need_moderation`
-> that was just a search indirection to `moderation_status`
- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
-> to be consistent with field name
- add name in result of `mail_partner_format`
-> sometimes display_name is not the same
- remove usage of `is_moderator`
-> that was just an indirection to `moderation_channel_ids`
Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171
closes odoo/odoo#55854
X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/thread_preview/thread_preview_tests.js')
| -rw-r--r-- | addons/mail/static/src/components/thread_preview/thread_preview_tests.js | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/addons/mail/static/src/components/thread_preview/thread_preview_tests.js b/addons/mail/static/src/components/thread_preview/thread_preview_tests.js index b34ce6cd3ad..ed6ce3b6356 100644 --- a/addons/mail/static/src/components/thread_preview/thread_preview_tests.js +++ b/addons/mail/static/src/components/thread_preview/thread_preview_tests.js @@ -6,10 +6,11 @@ const components = { }; const { - afterEach: utilsAfterEach, + afterEach, afterNextRender, - beforeEach: utilsBeforeEach, - start: utilsStart, + beforeEach, + createRootComponent, + start, } = require('mail/static/src/utils/test_utils.js'); QUnit.module('mail', {}, function () { @@ -17,18 +18,17 @@ QUnit.module('components', {}, function () { QUnit.module('thread_preview', {}, function () { QUnit.module('thread_preview_tests.js', { beforeEach() { - utilsBeforeEach(this); + beforeEach(this); this.createThreadPreviewComponent = async props => { - const ThreadPreviewComponent = components.ThreadPreview; - ThreadPreviewComponent.env = this.env; - this.component = new ThreadPreviewComponent(null, props); - delete ThreadPreviewComponent.env; - await afterNextRender(() => this.component.mount(this.widget.el)); + await createRootComponent(this, components.ThreadPreview, { + props, + target: this.widget.el, + }); }; this.start = async params => { - let { env, widget } = await utilsStart(Object.assign({}, params, { + const { env, widget } = await start(Object.assign({}, params, { data: this.data, })); this.env = env; @@ -36,16 +36,7 @@ QUnit.module('thread_preview_tests.js', { }; }, afterEach() { - utilsAfterEach(this); - if (this.component) { - this.component.destroy(); - this.component = undefined; - } - if (this.widget) { - this.widget.destroy(); - this.widget = undefined; - } - this.env = undefined; + afterEach(this); }, }); |
