mirror of https://github.com/zulip/zulip.git
presence tests: Test for offline/reload use cases.
This gets us to 100% line coverage.
This commit is contained in:
parent
379eed7159
commit
da6508a7af
|
@ -12,7 +12,7 @@ const OFFLINE_THRESHOLD_SECS = 140;
|
|||
|
||||
const me = {
|
||||
email: 'me@zulip.com',
|
||||
user_id: 999,
|
||||
user_id: 101,
|
||||
full_name: 'Me Myself',
|
||||
};
|
||||
|
||||
|
@ -52,6 +52,28 @@ run_test('my user', () => {
|
|||
assert.equal(presence.get_status(me.user_id), 'active');
|
||||
});
|
||||
|
||||
run_test('unknown user', () => {
|
||||
const unknown_user_id = 999;
|
||||
const now = 888888;
|
||||
const presences = {};
|
||||
presences[unknown_user_id.toString()] = 'does-not-matter';
|
||||
|
||||
blueslip.expect('error', 'Unknown user ID in presence data: 999');
|
||||
presence.set_info(presences, now);
|
||||
blueslip.reset();
|
||||
|
||||
// If the server is suspected to be offline or reloading,
|
||||
// then we suppress errors. The use case here is that we
|
||||
// haven't gotten info for a brand new user yet.
|
||||
server_events.suspect_offline = true;
|
||||
presence.set_info(presences, now);
|
||||
server_events.suspect_offline = false;
|
||||
|
||||
reload_state.is_in_progress = () => true;
|
||||
presence.set_info(presences, now);
|
||||
reload_state.is_in_progress = () => false;
|
||||
});
|
||||
|
||||
run_test('status_from_timestamp', () => {
|
||||
const status_from_timestamp = presence._status_from_timestamp;
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ EXEMPT_FILES = {
|
|||
'static/js/poll_widget.js',
|
||||
'static/js/popovers.js',
|
||||
# Temporarily missing full coverage
|
||||
'static/js/presence.js',
|
||||
'static/js/ready.js',
|
||||
'static/js/realm_icon.js',
|
||||
'static/js/realm_logo.js',
|
||||
|
|
Loading…
Reference in New Issue