summaryrefslogtreecommitdiff
path: root/addons/website_livechat/static/tests/helpers/mock_models.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_livechat/static/tests/helpers/mock_models.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_livechat/static/tests/helpers/mock_models.js')
-rw-r--r--addons/website_livechat/static/tests/helpers/mock_models.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/addons/website_livechat/static/tests/helpers/mock_models.js b/addons/website_livechat/static/tests/helpers/mock_models.js
new file mode 100644
index 00000000..bc407959
--- /dev/null
+++ b/addons/website_livechat/static/tests/helpers/mock_models.js
@@ -0,0 +1,45 @@
+odoo.define('website_livechat/static/tests/helpers/mock_models.js', function (require) {
+'use strict';
+
+const MockModels = require('mail/static/tests/helpers/mock_models.js');
+
+MockModels.patch('website_livechat/static/tests/helpers/mock_models.js', T =>
+ class extends T {
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ /**
+ * @override
+ */
+ static generateData() {
+ const data = super.generateData(...arguments);
+ Object.assign(data, {
+ 'website.visitor': {
+ fields: {
+ country_id: { string: "Country", type: 'many2one', relation: 'res.country' },
+ display_name: { string: "Display name", type: 'string' },
+ // Represent the browsing history of the visitor as a string.
+ // To ease testing this allows tests to set it directly instead
+ // of implementing the computation made on server.
+ // This should normally not be a field.
+ history: { string: "History", type: 'string'},
+ is_connected: { string: "Is connected", type: 'boolean' },
+ lang: { string: "Language", type: 'string'},
+ partner_id: {string: "partner", type: "many2one", relation: 'res.partner'},
+ website: { string: "Website", type: 'string' },
+ },
+ records: [],
+ },
+ });
+ Object.assign(data['mail.channel'].fields, {
+ livechat_visitor_id: { string: "Visitor", type: 'many2one', relation: 'website.visitor' },
+ });
+ return data;
+ }
+
+ }
+);
+
+});