Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node tests: Add test() wrapper to bot_data.
Steve Howell85bd196bfc54
diff --git a/frontend_tests/node_tests/bot_data.js b/frontend_tests/node_tests/bot_data.jsindex 84b6e7aeba3..487862453a6 100644--- a/frontend_tests/node_tests/bot_data.js+++ b/frontend_tests/node_tests/bot_data.js@@ -24,10 +24,6 @@ const fred = {user_id: 3,};-people.add_active_user(me);-people.add_active_user(fred);-people.initialize_current_user(me.user_id);-const bot_data_params = {realm_bots: [{email: "[email protected]", user_id: 42, full_name: "Bot 0", services: []},@@ -40,12 +36,20 @@ const bot_data_params = {],};-bot_data.initialize(bot_data_params);-// Our startup logic should have added Bot 0 from page_params.-assert.equal(bot_data.get(42).full_name, "Bot 0");-assert.equal(bot_data.get(314).full_name, "Outgoing webhook");--run_test("test_basics", () => {+function test(label, f) {+ run_test(label, (override) => {+ people.add_active_user(me);+ people.initialize_current_user(me.user_id);+ bot_data.initialize(bot_data_params);+ // Our startup logic should have added Bot 0 from page_params.+ assert.equal(bot_data.get(42).full_name, "Bot 0");+ assert.equal(bot_data.get(314).full_name, "Outgoing webhook");+ f(override);+ });+}++test("test_basics", () => {+ people.add_active_user(fred);const test_bot = {email: "[email protected]",user_id: 43,diff --git a/static/js/bot_data.js b/static/js/bot_data.jsindex 1c6027218d7..847e986b30d 100644--- a/static/js/bot_data.js+++ b/static/js/bot_data.js@@ -93,6 +93,7 @@ export function get_services(bot_id) {}export function initialize(params) {+ bots.clear();for (const bot of params.realm_bots) {add(bot);}