message_list: Add tests for sent_by_me.

This commit is contained in:
Cory Lynch 2017-06-07 02:11:01 -04:00 committed by Tim Abbott
parent 863c298d3c
commit 12d1086d14
1 changed files with 26 additions and 0 deletions

View File

@ -195,6 +195,32 @@ var MessageList = require('js/message_list').MessageList;
assert.equal(list.get(10).content, "ok!");
}());
(function test_last_sent_by_me() {
var table;
var filter = {};
var list = new MessageList(table, filter);
var items = [
{
id: 1,
sender_id: 3,
},
{
id: 2,
sender_id: 3,
},
{
id: 3,
sender_id: 6,
},
];
list.append(items);
set_global("page_params", {user_id: 3});
// Look for the last message where user_id == 3 (our ID)
assert.equal(list.get_last_message_sent_by_me().id, 2);
}());
(function test_local_echo() {
var table;
var filter = {};