2017-11-08 20:36:50 +01:00
|
|
|
var pmc = zrequire('pm_conversations');
|
2017-06-01 07:46:23 +02:00
|
|
|
|
2018-05-15 12:40:07 +02:00
|
|
|
run_test('partners', () => {
|
2017-06-01 07:46:23 +02:00
|
|
|
var user1_id = 1;
|
|
|
|
var user2_id = 2;
|
|
|
|
var user3_id = 3;
|
|
|
|
|
|
|
|
pmc.set_partner(user1_id);
|
|
|
|
pmc.set_partner(user3_id);
|
|
|
|
|
|
|
|
assert.equal(pmc.is_partner(user1_id), true);
|
|
|
|
assert.equal(pmc.is_partner(user2_id), false);
|
|
|
|
assert.equal(pmc.is_partner(user3_id), true);
|
2018-05-15 12:40:07 +02:00
|
|
|
});
|
2018-02-09 18:10:39 +01:00
|
|
|
|
2018-05-15 12:40:07 +02:00
|
|
|
run_test('insert_recent_private_message', () => {
|
2018-02-09 18:10:39 +01:00
|
|
|
pmc.recent.insert('1', 1001);
|
|
|
|
pmc.recent.insert('2', 2001);
|
|
|
|
pmc.recent.insert('1', 3001);
|
|
|
|
|
|
|
|
// try to backdate user1's timestamp
|
|
|
|
pmc.recent.insert('1', 555);
|
|
|
|
|
|
|
|
assert.deepEqual(pmc.recent.get(), [
|
|
|
|
{user_ids_string: '1', timestamp: 3001},
|
|
|
|
{user_ids_string: '2', timestamp: 2001},
|
|
|
|
]);
|
2018-02-09 21:13:38 +01:00
|
|
|
|
|
|
|
assert.deepEqual(pmc.recent.get_strings(), ['1', '2']);
|
2018-05-15 12:40:07 +02:00
|
|
|
});
|
2018-02-09 18:10:39 +01:00
|
|
|
|