From f461139d26ad9e32afac4218c6fdb4790b4c07a4 Mon Sep 17 00:00:00 2001 From: YashRE42 <33805964+YashRE42@users.noreply.github.com> Date: Sat, 20 Mar 2021 08:41:03 +0000 Subject: [PATCH] message_flags: Verify early return when starring local echo. --- frontend_tests/node_tests/message_flags.js | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frontend_tests/node_tests/message_flags.js b/frontend_tests/node_tests/message_flags.js index 3e8f8d515e..74f0bfad87 100644 --- a/frontend_tests/node_tests/message_flags.js +++ b/frontend_tests/node_tests/message_flags.js @@ -65,6 +65,29 @@ run_test("starred", (override) => { starred: false, }); }); + +run_test("starring local echo", () => { + // verify early return for locally echoed message + const locally_echoed_message = { + id: 51, + starred: false, + locally_echoed: true, + }; + + message_flags.toggle_starred_and_update_server(locally_echoed_message); + + // ui.update_starred_view not called + + // channel post request not made + + // starred flag unchanged + assert.deepEqual(locally_echoed_message, { + id: 51, + locally_echoed: true, + starred: false, + }); +}); + run_test("read", (override) => { // Way to capture posted info in every request let channel_post_opts;