From dcccef9b3a0af0e5f693c46a6e99a14acd4a7f0a Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 21 Oct 2019 17:02:32 -0700 Subject: [PATCH] typing_status: Make some test cases slightly less artificial. All these cases are meant to simulate having a user actually typing a message to some actual recipients, so the `conversation_is_valid` parameter would be true. We make this change so that in an upcoming change that eliminates this parameter, the adjustments to the test cases can be highly regular and we don't have to introduce a new wrinkle to correspond to these values being false. --- frontend_tests/node_tests/typing_status.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js index 89cb950af8..6adf005e52 100644 --- a/frontend_tests/node_tests/typing_status.js +++ b/frontend_tests/node_tests/typing_status.js @@ -266,6 +266,7 @@ run_test('basics', () => { const call_count = { maybe_ping_server: 0, + actually_ping_server: 0, start_or_extend_idle_timer: 0, stop_last_notification: 0, }; @@ -280,12 +281,12 @@ run_test('basics', () => { // User ids of poeple in compose narrow doesn't change and is same as stat.current_recipent // so counts of function should increase except stop_last_notification - typing_status.handle_text_input(worker, typing.get_recipient(), false); + typing_status.handle_text_input(worker, typing.get_recipient(), true); assert.deepEqual(call_count.maybe_ping_server, 1); assert.deepEqual(call_count.start_or_extend_idle_timer, 1); assert.deepEqual(call_count.stop_last_notification, 0); - typing_status.handle_text_input(worker, typing.get_recipient(), false); + typing_status.handle_text_input(worker, typing.get_recipient(), true); assert.deepEqual(call_count.maybe_ping_server, 2); assert.deepEqual(call_count.start_or_extend_idle_timer, 2); assert.deepEqual(call_count.stop_last_notification, 0); @@ -293,8 +294,8 @@ run_test('basics', () => { // change in recipient and new_recipient should make us // call typing_status.stop_last_notification compose_pm_pill.get_user_ids_string = () => '2,3,4'; - typing_status.handle_text_input(worker, typing.get_recipient(), false); + typing_status.handle_text_input(worker, typing.get_recipient(), true); assert.deepEqual(call_count.maybe_ping_server, 2); - assert.deepEqual(call_count.start_or_extend_idle_timer, 2); + assert.deepEqual(call_count.start_or_extend_idle_timer, 3); assert.deepEqual(call_count.stop_last_notification, 1); });