tests: Use tricky server data in unit tests.

The server may send us ids in the order
[11, 2], instead of [2, 11].  We don't want
to rely on server behavior, regardless, for
the sort.

Our tests now show we process that data.

The current code is is still buggy and causes
us to show the same huddle two different times
for situations where the lexical sort doesn't
match the numerical sort.

This happens on czo often, where Tim is user
7, and his id sorts lexically after ids like
58, 622, 4444, etc.
This commit is contained in:
Steve Howell 2020-01-01 14:26:25 +00:00 committed by Tim Abbott
parent 8f281c4fc9
commit ab6f4af33a
1 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ zrequire("people");
run_test('insert_recent_private_message', () => {
set_global('page_params', {
recent_private_conversations: [
{user_ids: [1, 2],
{user_ids: [11, 2],
max_message_id: 150,
},
{user_ids: [1],
@ -33,7 +33,7 @@ run_test('insert_recent_private_message', () => {
pmc.recent.initialize();
assert.deepEqual(pmc.recent.get(), [
{user_ids_string: '1,2', max_message_id: 150},
{user_ids_string: '11,2', max_message_id: 150},
{user_ids_string: '1', max_message_id: 111},
{user_ids_string: '15', max_message_id: 7},
]);
@ -48,9 +48,9 @@ run_test('insert_recent_private_message', () => {
assert.deepEqual(pmc.recent.get(), [
{user_ids_string: '1', max_message_id: 3001},
{user_ids_string: '2', max_message_id: 2001},
{user_ids_string: '1,2', max_message_id: 150},
{user_ids_string: '11,2', max_message_id: 150},
{user_ids_string: '15', max_message_id: 7},
]);
assert.deepEqual(pmc.recent.get_strings(), ['1', '2', '1,2', '15']);
assert.deepEqual(pmc.recent.get_strings(), ['1', '2', '11,2', '15']);
});