2017-12-15 00:30:11 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
describe('ConversationController', function() {
|
|
|
|
it('sorts conversations based on timestamp then by intl-friendly title', function() {
|
|
|
|
var collection = window.getInboxCollection();
|
|
|
|
collection.reset([]);
|
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
collection.add(
|
|
|
|
new Whisper.Conversation({
|
|
|
|
name: 'No timestamp',
|
|
|
|
})
|
|
|
|
);
|
|
|
|
collection.add(
|
|
|
|
new Whisper.Conversation({
|
|
|
|
name: 'B',
|
|
|
|
timestamp: 20,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
collection.add(
|
|
|
|
new Whisper.Conversation({
|
|
|
|
name: 'C',
|
|
|
|
timestamp: 20,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
collection.add(
|
|
|
|
new Whisper.Conversation({
|
|
|
|
name: 'Á',
|
|
|
|
timestamp: 20,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
collection.add(
|
|
|
|
new Whisper.Conversation({
|
|
|
|
name: 'First!',
|
|
|
|
timestamp: 30,
|
|
|
|
})
|
|
|
|
);
|
2017-12-15 00:30:11 +00:00
|
|
|
|
|
|
|
assert.strictEqual(collection.at('0').get('name'), 'First!');
|
|
|
|
assert.strictEqual(collection.at('1').get('name'), 'Á');
|
|
|
|
assert.strictEqual(collection.at('2').get('name'), 'B');
|
|
|
|
assert.strictEqual(collection.at('3').get('name'), 'C');
|
|
|
|
assert.strictEqual(collection.at('4').get('name'), 'No timestamp');
|
|
|
|
|
|
|
|
collection.reset([]);
|
|
|
|
});
|
|
|
|
});
|