Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node tests: Use mock_template in i18n.
Steve Howelle8b40a9a0391
diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.jsindex 5f36547f865..ac72ebf0071 100644--- a/frontend_tests/node_tests/i18n.js+++ b/frontend_tests/node_tests/i18n.js@@ -4,7 +4,7 @@ const {strict: assert} = require("assert");const _ = require("lodash");-const {unmock_module, zrequire} = require("../zjsunit/namespace");+const {mock_template, unmock_module, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");const {page_params} = require("../zjsunit/zpage_params");@@ -20,6 +20,9 @@ page_params.translation_data = {"<p>Le canal <b>{stream_name}</b> n'existe pas.</p><p>Gérez vos abonnements <z-link>sur votre page canaux</z-link>.</p>",};+const render_actions_popover_content = mock_template("actions_popover_content.hbs", true);+const render_settings_tab = mock_template("settings_tab.hbs", true);+// All of our other tests stub out i18n activity;// here we do a quick sanity check on the engine itself.// `i18n.js` initializes FormatJS and is imported by@@ -63,7 +66,7 @@ run_test("$tr", () => {);});-run_test("t_tag", () => {+run_test("t_tag", ({override}) => {const args = {message: {is_stream: true,@@ -79,11 +82,15 @@ run_test("t_tag", () => {topic: "testing",};- const html = require("../../static/templates/actions_popover_content.hbs")(args);- assert.ok(html.indexOf("Citer et répondre ou transférer") > 0);+ override(render_actions_popover_content, "f", (data, html) => {+ assert.equal(data, args);+ assert.ok(html.indexOf("Citer et répondre ou transférer") > 0);+ });++ require("../../static/templates/actions_popover_content.hbs")(args);});-run_test("tr_tag", () => {+run_test("tr_tag", ({override}) => {const args = {page_params: {full_name: "John Doe",@@ -103,8 +110,11 @@ run_test("tr_tag", () => {},};- const html = require("../../static/templates/settings_tab.hbs")(args);- assert.ok(html.indexOf("Déclencheurs de notification") > 0);+ override(render_settings_tab, "f", (data, html) => {+ assert.equal(data, args);+ assert.ok(html.indexOf("Déclencheurs de notification") > 0);+ });+ require("../../static/templates/settings_tab.hbs")(args);});run_test("language_list", () => {