Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node tests: Use mock_template for pill_typeahead.

Steve Howellfb15d297da72
diff --git a/frontend_tests/node_tests/pill_typeahead.js b/frontend_tests/node_tests/pill_typeahead.js
index e2d10fcd5e2..f952bfef3b8 100644
--- a/frontend_tests/node_tests/pill_typeahead.js
+++ b/frontend_tests/node_tests/pill_typeahead.js
@@ -2,11 +2,13 @@
const {strict: assert} = require("assert");
-const {zrequire, mock_esm} = require("../zjsunit/namespace");
+const {zrequire, mock_esm, mock_template} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
+const render_input_pill = mock_template("input_pill.hbs", true);
+
const input_pill = zrequire("input_pill");
const pill_typeahead = zrequire("pill_typeahead");
const noop = function () {};
@@ -105,7 +107,13 @@ for (const sub of subs) {
stream_data.add_sub(sub);
}
-run_test("set_up", () => {
+run_test("set_up", ({override}) => {
+ override(render_input_pill, "f", (data, html) => {
+ assert.equal(typeof data.id, "string");
+ assert.equal(typeof data.display_value, "string");
+ assert.equal(typeof data.has_image, "boolean");
+ return html;
+ });
let input_pill_typeahead_called = false;
const fake_input = $.create(".input");
fake_input.before = noop;